start cleaning up the code
This commit is contained in:
parent
779f4da011
commit
e5042cc296
0
__init__.py
Normal file
0
__init__.py
Normal file
0
core/__init__.py
Normal file
0
core/__init__.py
Normal file
@ -1,7 +1,7 @@
|
||||
from mpParamXp import MpParamXp
|
||||
from .parameter import ExperienceParameter
|
||||
from mpMultiInterfaceTopo import MpMultiInterfaceTopo
|
||||
|
||||
class MpExperience:
|
||||
class Experience:
|
||||
PING = "ping"
|
||||
NCPV = "ncpv"
|
||||
NC = "nc"
|
||||
@ -45,15 +45,15 @@ class MpExperience:
|
||||
pass
|
||||
|
||||
def changeMetric(self):
|
||||
metric = self.xpParam.getParam(MpParamXp.METRIC)
|
||||
metric = self.xpParam.getParam(ExperienceParameter.METRIC)
|
||||
if int(metric) >= 0:
|
||||
self.mpTopo.notNSCommand("echo " + metric + " > /sys/module/mptcp_sched_metric/parameters/metric")
|
||||
|
||||
def putPriorityOnPaths(self):
|
||||
# Only meaningful if mpTopo is instance of MpMultiInterfaceTopo
|
||||
if isinstance(self.mpTopo, MpMultiInterfaceTopo):
|
||||
prioPath0 = self.xpParam.getParam(MpParamXp.PRIOPATH0)
|
||||
prioPath1 = self.xpParam.getParam(MpParamXp.PRIOPATH1)
|
||||
prioPath0 = self.xpParam.getParam(ExperienceParameter.PRIOPATH0)
|
||||
prioPath1 = self.xpParam.getParam(ExperienceParameter.PRIOPATH1)
|
||||
if not prioPath0 == prioPath1:
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "/home/mininet/iproute/ip/ip link set dev " +
|
||||
self.mpConfig.getClientInterface(0) + " priority " + str(prioPath0))
|
||||
@ -66,11 +66,11 @@ class MpExperience:
|
||||
self.mpConfig.getRouterInterfaceSwitch(1) + " priority " +
|
||||
str(prioPath1))
|
||||
|
||||
backupPath0 = self.xpParam.getParam(MpParamXp.BACKUPPATH0)
|
||||
backupPath0 = self.xpParam.getParam(ExperienceParameter.BACKUPPATH0)
|
||||
if int(backupPath0) > 0:
|
||||
self.mpTopo.commandTo(self.mpConfig.client, self.mpConfig.interfaceBUPCommand(self.mpConfig.getClientInterface(0)))
|
||||
self.mpTopo.commandTo(self.mpConfig.router, self.mpConfig.interfaceBUPCommand(self.mpConfig.getRouterInterfaceSwitch(0)))
|
||||
backupPath1 = self.xpParam.getParam(MpParamXp.BACKUPPATH1)
|
||||
backupPath1 = self.xpParam.getParam(ExperienceParameter.BACKUPPATH1)
|
||||
if int(backupPath1) > 0:
|
||||
self.mpTopo.commandTo(self.mpConfig.client, self.mpConfig.interfaceBUPCommand(self.mpConfig.getClientInterface(1)))
|
||||
self.mpTopo.commandTo(self.mpConfig.router, self.mpConfig.interfaceBUPCommand(self.mpConfig.getRouterInterfaceSwitch(1)))
|
||||
@ -106,31 +106,31 @@ class MpExperience:
|
||||
self.mpTopo.commandTo(self.mpConfig.router, cmd)
|
||||
|
||||
def runUserspacePM(self):
|
||||
if self.xpParam.getParam(MpParamXp.KERNELPMC) != "netlink":
|
||||
if self.xpParam.getParam(ExperienceParameter.KERNELPMC) != "netlink":
|
||||
print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !")
|
||||
else:
|
||||
upmc = self.xpParam.getParam(MpParamXp.USERPMC)
|
||||
upmca = self.xpParam.getParam(MpParamXp.USERPMCARGS)
|
||||
upmc = self.xpParam.getParam(ExperienceParameter.USERPMC)
|
||||
upmca = self.xpParam.getParam(ExperienceParameter.USERPMCARGS)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, upmc + \
|
||||
" " + upmca + " &>upmc.log &")
|
||||
if self.xpParam.getParam(MpParamXp.KERNELPMS) != "netlink":
|
||||
if self.xpParam.getParam(ExperienceParameter.KERNELPMS) != "netlink":
|
||||
print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !")
|
||||
else:
|
||||
upms = self.xpParam.getParam(MpParamXp.USERPMS)
|
||||
upmsa = self.xpParam.getParam(MpParamXp.USERPMSARGS)
|
||||
upms = self.xpParam.getParam(ExperienceParameter.USERPMS)
|
||||
upmsa = self.xpParam.getParam(ExperienceParameter.USERPMSARGS)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, upms + \
|
||||
" " + upmsa + " &>upms.log &")
|
||||
|
||||
def cleanUserspacePM(self):
|
||||
if self.xpParam.getParam(MpParamXp.KERNELPMC) != "netlink":
|
||||
if self.xpParam.getParam(ExperienceParameter.KERNELPMC) != "netlink":
|
||||
print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !")
|
||||
else:
|
||||
upmc = self.xpParam.getParam(MpParamXp.USERPMC)
|
||||
upmc = self.xpParam.getParam(ExperienceParameter.USERPMC)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "killall " + upmc)
|
||||
if self.xpParam.getParam(MpParamXp.KERNELPMS) != "netlink":
|
||||
if self.xpParam.getParam(ExperienceParameter.KERNELPMS) != "netlink":
|
||||
print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !")
|
||||
else:
|
||||
upms = self.xpParam.getParam(MpParamXp.USERPMS)
|
||||
upms = self.xpParam.getParam(ExperienceParameter.USERPMS)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "killall " + upms)
|
||||
|
||||
def runNetemAt(self):
|
||||
@ -191,12 +191,12 @@ class MpExperience:
|
||||
|
||||
def saveSysctl(self):
|
||||
self.sysctlBUP = {}
|
||||
self._saveSysctl(MpParamXp.sysctlKey, self.sysctlBUP)
|
||||
self._saveSysctl(ExperienceParameter.sysctlKey, self.sysctlBUP)
|
||||
self.sysctlBUPC = {}
|
||||
self._saveSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC,
|
||||
self._saveSysctl(ExperienceParameter.sysctlKeyClient, self.sysctlBUPC,
|
||||
ns = True, who = self.mpConfig.client)
|
||||
self.sysctlBUPS = {}
|
||||
self._saveSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS,
|
||||
self._saveSysctl(ExperienceParameter.sysctlKeyServer, self.sysctlBUPS,
|
||||
ns = True, who = self.mpConfig.server)
|
||||
|
||||
def _saveSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None):
|
||||
@ -226,10 +226,10 @@ class MpExperience:
|
||||
return s
|
||||
|
||||
def writeSysctl(self):
|
||||
self._writeSysctl(MpParamXp.sysctlKey, self.sysctlBUP)
|
||||
self._writeSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC,
|
||||
self._writeSysctl(ExperienceParameter.sysctlKey, self.sysctlBUP)
|
||||
self._writeSysctl(ExperienceParameter.sysctlKeyClient, self.sysctlBUPC,
|
||||
ns = True, who = self.mpConfig.client)
|
||||
self._writeSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS,
|
||||
self._writeSysctl(ExperienceParameter.sysctlKeyServer, self.sysctlBUPS,
|
||||
ns = True, who = self.mpConfig.server)
|
||||
|
||||
def _writeSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None):
|
||||
@ -246,10 +246,10 @@ class MpExperience:
|
||||
|
||||
|
||||
def backUpSysctl(self):
|
||||
self._backUpSysctl(MpParamXp.sysctlKey, self.sysctlBUP)
|
||||
self._backUpSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC,
|
||||
self._backUpSysctl(ExperienceParameter.sysctlKey, self.sysctlBUP)
|
||||
self._backUpSysctl(ExperienceParameter.sysctlKeyClient, self.sysctlBUPC,
|
||||
ns = True, who = self.mpConfig.client)
|
||||
self._backUpSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS,
|
||||
self._backUpSysctl(ExperienceParameter.sysctlKeyServer, self.sysctlBUPS,
|
||||
ns = True, who = self.mpConfig.server)
|
||||
|
||||
|
||||
@ -269,9 +269,9 @@ class MpExperience:
|
||||
|
||||
def runTcpDump(self):
|
||||
#todo : replace filename by cst
|
||||
cpcap = self.xpParam.getParam(MpParamXp.CLIENTPCAP)
|
||||
spcap = self.xpParam.getParam(MpParamXp.SERVERPCAP)
|
||||
snaplenpcap = self.xpParam.getParam(MpParamXp.SNAPLENPCAP)
|
||||
cpcap = self.xpParam.getParam(ExperienceParameter.CLIENTPCAP)
|
||||
spcap = self.xpParam.getParam(ExperienceParameter.SERVERPCAP)
|
||||
snaplenpcap = self.xpParam.getParam(ExperienceParameter.SNAPLENPCAP)
|
||||
if cpcap == "yes" :
|
||||
self.mpTopo.commandTo(self.mpConfig.client,
|
||||
"tcpdump -i any -s " + snaplenpcap + " -w client.pcap &")
|
@ -1,6 +1,48 @@
|
||||
from mpParam import MpParam
|
||||
|
||||
class MpParamXp(MpParam):
|
||||
class Parameter:
|
||||
def __init__(self, paramFile):
|
||||
self.paramDic = {}
|
||||
print("Create the param Object")
|
||||
if paramFile is None:
|
||||
print("default param...")
|
||||
else:
|
||||
self.loadParamFile(paramFile)
|
||||
|
||||
def loadParamFile(self, paramFile):
|
||||
f = open(paramFile)
|
||||
i = 0
|
||||
for l in f:
|
||||
i = i + 1
|
||||
if l.startswith("#"):
|
||||
continue
|
||||
|
||||
tab = l.split(":")
|
||||
if len(tab) == 2:
|
||||
k = tab[0]
|
||||
val = tab[1].rstrip()
|
||||
if k in self.paramDic:
|
||||
if not isinstance(self.paramDic[k], list):
|
||||
self.paramDic[k] = [self.paramDic[k]]
|
||||
self.paramDic[k].append(val)
|
||||
else:
|
||||
self.paramDic[k] = val
|
||||
else:
|
||||
print("Ignored Line " + str(i))
|
||||
print(l),
|
||||
print("In file " + paramFile)
|
||||
f.close()
|
||||
|
||||
def getParam(self, key):
|
||||
if key in self.paramDic:
|
||||
return self.paramDic[key]
|
||||
return None
|
||||
|
||||
def __str__(self):
|
||||
s = self.paramDic.__str__()
|
||||
return s
|
||||
|
||||
|
||||
class ExperienceParameter(Parameter):
|
||||
|
||||
RMEM = "rmem"
|
||||
WMEM = "wmem"
|
||||
@ -166,18 +208,16 @@ class MpParamXp(MpParam):
|
||||
defaultValue[BACKUPPATH1] = "0"
|
||||
|
||||
def __init__(self, paramFile):
|
||||
MpParam.__init__(self, paramFile)
|
||||
super().__init__(paramFile)
|
||||
|
||||
def getParam(self, key):
|
||||
val = MpParam.getParam(self, key)
|
||||
val = super().getParam(key)
|
||||
if val is None:
|
||||
if key in MpParamXp.defaultValue:
|
||||
return MpParamXp.defaultValue[key]
|
||||
if key in ExperienceParameter.defaultValue:
|
||||
return ExperienceParameter.defaultValue[key]
|
||||
else:
|
||||
raise Exception("Param not found " + key)
|
||||
raise Exception("Parameter not found " + key)
|
||||
else:
|
||||
return val
|
||||
|
||||
def __str__(self):
|
||||
s = MpParam.__str__(self)
|
||||
return s
|
||||
|
232
core/topo.py
Normal file
232
core/topo.py
Normal file
@ -0,0 +1,232 @@
|
||||
from .parameter import Parameter
|
||||
|
||||
from mpLinkCharacteristics import MpLinkCharacteristics
|
||||
from mpNetemAt import MpNetemAt
|
||||
|
||||
class TopoParameter(Parameter):
|
||||
LSUBNET = "leftSubnet"
|
||||
RSUBNET = "rightSubnet"
|
||||
netemAt = "netemAt_"
|
||||
changeNetem = "changeNetem"
|
||||
defaultValue = {}
|
||||
defaultValue[LSUBNET] = "10.1."
|
||||
defaultValue[RSUBNET] = "10.2."
|
||||
defaultValue[changeNetem] = "false"
|
||||
|
||||
def __init__(self, paramFile):
|
||||
Parameter.__init__(self, paramFile)
|
||||
self.linkCharacteristics = []
|
||||
self.loadLinkCharacteristics()
|
||||
self.loadNetemAt()
|
||||
print(self.__str__())
|
||||
|
||||
def loadNetemAt(self):
|
||||
if not self.getParam(TopoParameter.changeNetem) == "yes":
|
||||
return
|
||||
for k in sorted(self.paramDic):
|
||||
if k.startswith(TopoParameter.netemAt):
|
||||
i = int(k[len(TopoParameter.netemAt):])
|
||||
val = self.paramDic[k]
|
||||
if not isinstance(val, list):
|
||||
tmp = val
|
||||
val = []
|
||||
val.append(tmp)
|
||||
self.loadNetemAtList(i, val)
|
||||
|
||||
def loadNetemAtList(self, id, nlist):
|
||||
for n in nlist:
|
||||
tab = n.split(",")
|
||||
if len(tab)==2:
|
||||
o = MpNetemAt(float(tab[0]), tab[1])
|
||||
if id < len(self.linkCharacteristics):
|
||||
self.linkCharacteristics[id].addNetemAt(o)
|
||||
else:
|
||||
print("Error can't set netem for link " + str(id))
|
||||
else:
|
||||
print("Netem wrong line : " + n)
|
||||
print(self.linkCharacteristics[id].netemAt)
|
||||
|
||||
def loadLinkCharacteristics(self):
|
||||
i = 0
|
||||
for k in sorted(self.paramDic):
|
||||
if k.startswith("path"):
|
||||
tab = self.paramDic[k].split(",")
|
||||
bup = False
|
||||
loss = "0.0"
|
||||
if len(tab) == 5:
|
||||
loss = tab[3]
|
||||
bup = tab[4] == 'True'
|
||||
if len(tab) == 4:
|
||||
try:
|
||||
loss = float(tab[3])
|
||||
loss = tab[3]
|
||||
except ValueError:
|
||||
bup = tab[3] == 'True'
|
||||
if len(tab) == 3 or len(tab) == 4 or len(tab) == 5:
|
||||
path = MpLinkCharacteristics(i,tab[0],
|
||||
tab[1], tab[2], loss, bup)
|
||||
self.linkCharacteristics.append(path)
|
||||
i = i + 1
|
||||
else:
|
||||
print("Ignored path :")
|
||||
print(self.paramDic[k])
|
||||
|
||||
def getParam(self, key):
|
||||
val = Parameter.getParam(self, key)
|
||||
if val is None:
|
||||
if key in TopoParameter.defaultValue:
|
||||
return TopoParameter.defaultValue[key]
|
||||
else:
|
||||
raise Exception("Param not found " + key)
|
||||
else:
|
||||
return val
|
||||
|
||||
def __str__(self):
|
||||
s = Parameter.__str__(self)
|
||||
s = s + "\n"
|
||||
for p in self.linkCharacteristics[:-1]:
|
||||
s = s + p.__str__() + "\n"
|
||||
s = s + self.linkCharacteristics[-1].__str__()
|
||||
return s
|
||||
|
||||
class Topo:
|
||||
mininetBuilder = "mininet"
|
||||
multiIfTopo = "MultiIf"
|
||||
ECMPLikeTopo = "ECMPLike"
|
||||
twoIfCongTopo = "twoIfCong"
|
||||
multiIfCongTopo = "MultiIfCong"
|
||||
topoAttr = "topoType"
|
||||
switchNamePrefix = "s"
|
||||
routerNamePrefix = "r"
|
||||
clientName = "Client"
|
||||
serverName = "Server"
|
||||
routerName = "Router"
|
||||
cmdLog = "command.log"
|
||||
|
||||
"""Simple MpTopo"""
|
||||
def __init__(self, topoBuilder, topoParam):
|
||||
self.topoBuilder = topoBuilder
|
||||
self.topoParam = topoParam
|
||||
self.changeNetem = topoParam.getParam(TopoParameter.changeNetem)
|
||||
self.logFile = open(Topo.cmdLog, 'w')
|
||||
|
||||
def getLinkCharacteristics(self):
|
||||
return self.topoParam.linkCharacteristics
|
||||
|
||||
def commandTo(self, who, cmd):
|
||||
self.logFile.write(who.__str__() + " : " + cmd + "\n")
|
||||
return self.topoBuilder.commandTo(who, cmd)
|
||||
|
||||
def notNSCommand(self, cmd):
|
||||
"""
|
||||
mainly use for not namespace sysctl.
|
||||
"""
|
||||
self.logFile.write("Not_NS" + " : " + cmd + "\n")
|
||||
return self.topoBuilder.notNSCommand(cmd)
|
||||
|
||||
def getHost(self, who):
|
||||
return self.topoBuilder.getHost(who)
|
||||
|
||||
def addHost(self, host):
|
||||
return self.topoBuilder.addHost(host)
|
||||
|
||||
def addSwitch(self, switch):
|
||||
return self.topoBuilder.addSwitch(switch)
|
||||
|
||||
def addLink(self, fromA, toB, **kwargs):
|
||||
self.topoBuilder.addLink(fromA,toB,**kwargs)
|
||||
|
||||
def getCLI(self):
|
||||
self.topoBuilder.getCLI()
|
||||
|
||||
def startNetwork(self):
|
||||
self.topoBuilder.startNetwork()
|
||||
|
||||
def closeLogFile(self):
|
||||
self.logFile.close()
|
||||
|
||||
def stopNetwork(self):
|
||||
self.topoBuilder.stopNetwork()
|
||||
|
||||
|
||||
class TopoConfig:
|
||||
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, topo, param):
|
||||
self.topo = topo
|
||||
self.param = param
|
||||
|
||||
def configureNetwork(self):
|
||||
print("Configure interfaces....Generic call ?")
|
||||
self.configureInterfaces()
|
||||
self.configureRoute()
|
||||
|
||||
def getMidL2RInterface(self, id):
|
||||
"get Middle link, left to right interface"
|
||||
pass
|
||||
|
||||
def getMidR2LInterface(self, id):
|
||||
pass
|
||||
|
||||
def getMidLeftName(self, i):
|
||||
"get Middle link, left box name"
|
||||
pass
|
||||
|
||||
def getMidRightName(self, i):
|
||||
pass
|
||||
|
||||
def configureInterfaces(self):
|
||||
pass
|
||||
|
||||
def getClientInterfaceCount(self):
|
||||
raise Exception("To be implemented")
|
||||
|
||||
def interfaceBUPCommand(self, interfaceName):
|
||||
s = "/home/mininet/git/iproute-mptcp/ip/ip link set dev " + interfaceName + " multipath backup "
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def interfaceUpCommand(self, interfaceName, ip, subnet):
|
||||
s = "ifconfig " + interfaceName + " " + ip + " netmask " + \
|
||||
subnet
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def addRouteTableCommand(self, fromIP, id):
|
||||
s = "ip rule add from " + fromIP + " table " + str(id + 1)
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def addRouteScopeLinkCommand(self, network, interfaceName, id):
|
||||
s = "ip route add " + network + " dev " + interfaceName + \
|
||||
" scope link table " + str(id + 1)
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def addRouteDefaultCommand(self, via, id):
|
||||
s = "ip route add default via " + via + " table " + str(id + 1)
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def addRouteDefaultGlobalCommand(self, via, interfaceName):
|
||||
s = "ip route add default scope global nexthop via " + via + \
|
||||
" dev " + interfaceName
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def arpCommand(self, ip, mac):
|
||||
s = "arp -s " + ip + " " + mac
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def addRouteDefaultSimple(self, via):
|
||||
s = "ip route add default via " + via
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + TopoConfig.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
81
mpConfig.py
81
mpConfig.py
@ -1,81 +0,0 @@
|
||||
class MpConfig:
|
||||
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, topo, param):
|
||||
self.topo = topo
|
||||
self.param = param
|
||||
|
||||
def configureNetwork(self):
|
||||
print("Configure interfaces....Generic call ?")
|
||||
self.configureInterfaces()
|
||||
self.configureRoute()
|
||||
|
||||
def getMidL2RInterface(self, id):
|
||||
"get Middle link, left to right interface"
|
||||
pass
|
||||
|
||||
def getMidR2LInterface(self, id):
|
||||
pass
|
||||
|
||||
def getMidLeftName(self, i):
|
||||
"get Middle link, left box name"
|
||||
pass
|
||||
|
||||
def getMidRightName(self, i):
|
||||
pass
|
||||
|
||||
def configureInterfaces(self):
|
||||
pass
|
||||
|
||||
def getClientInterfaceCount(self):
|
||||
raise Exception("To be implemented")
|
||||
|
||||
def interfaceBUPCommand(self, interfaceName):
|
||||
s = "/home/mininet/git/iproute-mptcp/ip/ip link set dev " + interfaceName + " multipath backup "
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def interfaceUpCommand(self, interfaceName, ip, subnet):
|
||||
s = "ifconfig " + interfaceName + " " + ip + " netmask " + \
|
||||
subnet
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def addRouteTableCommand(self, fromIP, id):
|
||||
s = "ip rule add from " + fromIP + " table " + str(id + 1)
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def addRouteScopeLinkCommand(self, network, interfaceName, id):
|
||||
s = "ip route add " + network + " dev " + interfaceName + \
|
||||
" scope link table " + str(id + 1)
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def addRouteDefaultCommand(self, via, id):
|
||||
s = "ip route add default via " + via + " table " + str(id + 1)
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def addRouteDefaultGlobalCommand(self, via, interfaceName):
|
||||
s = "ip route add default scope global nexthop via " + via + \
|
||||
" dev " + interfaceName
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def arpCommand(self, ip, mac):
|
||||
s = "arp -s " + ip + " " + mac
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def addRouteDefaultSimple(self, via):
|
||||
s = "ip route add default via " + via
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpConfig.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
@ -1,12 +1,10 @@
|
||||
from mpConfig import MpConfig
|
||||
from core.topo import Topo, TopoConfig, TopoParameter
|
||||
from mpECMPSingleInterfaceTopo import MpECMPSingleInterfaceTopo
|
||||
from mpParamTopo import MpParamTopo
|
||||
from mpTopo import MpTopo
|
||||
from struct import *
|
||||
|
||||
class MpECMPSingleInterfaceConfig(MpConfig):
|
||||
class MpECMPSingleInterfaceConfig(TopoConfig):
|
||||
def __init__(self, topo, param):
|
||||
MpConfig.__init__(self, topo, param)
|
||||
super().__init__(topo, param)
|
||||
|
||||
def configureRoute(self):
|
||||
i = 0
|
||||
@ -86,14 +84,14 @@ class MpECMPSingleInterfaceConfig(MpConfig):
|
||||
return s
|
||||
|
||||
def configureInterfaces(self):
|
||||
self.client = self.topo.getHost(MpTopo.clientName)
|
||||
self.server = self.topo.getHost(MpTopo.serverName)
|
||||
self.client = self.topo.getHost(Topo.clientName)
|
||||
self.server = self.topo.getHost(Topo.serverName)
|
||||
self.routers = []
|
||||
i = 0
|
||||
netmask = "255.255.255.0"
|
||||
for l in self.topo.routers:
|
||||
self.routers.append(self.topo.getHost(
|
||||
MpTopo.routerNamePrefix + str(i)))
|
||||
Topo.routerNamePrefix + str(i)))
|
||||
cmd = self.interfaceUpCommand(
|
||||
self.getRouterInterfaceLSwitch(i),
|
||||
self.getRouterIPClient(i), netmask)
|
||||
@ -115,27 +113,27 @@ class MpECMPSingleInterfaceConfig(MpConfig):
|
||||
self.topo.commandTo(self.server, cmd)
|
||||
|
||||
def getClientIP(self, interfaceID):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
clientIP = lSubnet + str(interfaceID) + ".1"
|
||||
return clientIP
|
||||
|
||||
def getClientSubnet(self, interfaceID):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
clientSubnet = lSubnet + str(interfaceID) + ".0/24"
|
||||
return clientSubnet
|
||||
|
||||
def getRouterIPClient(self, id):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
routerIP = lSubnet + "0." + str(id + 2)
|
||||
return routerIP
|
||||
|
||||
def getRouterIPServer(self, id):
|
||||
rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
|
||||
rSubnet = self.param.getParam(TopoParameter.RSUBNET)
|
||||
routerIP = rSubnet + "0." + str(id + 2)
|
||||
return routerIP
|
||||
|
||||
def getServerIP(self):
|
||||
rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
|
||||
rSubnet = self.param.getParam(TopoParameter.RSUBNET)
|
||||
serverIP = rSubnet + "0.1"
|
||||
return serverIP
|
||||
|
||||
@ -143,22 +141,22 @@ class MpECMPSingleInterfaceConfig(MpConfig):
|
||||
return 1
|
||||
|
||||
def getRouterInterfaceLSwitch(self, id):
|
||||
return MpTopo.routerNamePrefix + str(id) + "-eth0"
|
||||
return Topo.routerNamePrefix + str(id) + "-eth0"
|
||||
|
||||
def getRouterInterfaceRSwitch(self, id):
|
||||
return MpTopo.routerNamePrefix + str(id) + "-eth1"
|
||||
return Topo.routerNamePrefix + str(id) + "-eth1"
|
||||
|
||||
def getClientInterface(self, interfaceID):
|
||||
return MpTopo.clientName + "-eth" + str(interfaceID)
|
||||
return Topo.clientName + "-eth" + str(interfaceID)
|
||||
|
||||
def getServerInterface(self):
|
||||
return MpTopo.serverName + "-eth0"
|
||||
return Topo.serverName + "-eth0"
|
||||
|
||||
def getMidLeftName(self, id):
|
||||
return MpTopo.routerNamePrefix + str(id)
|
||||
return Topo.routerNamePrefix + str(id)
|
||||
|
||||
def getMidRightName(self, id):
|
||||
return MpTopo.switchNamePrefix + "1"
|
||||
return Topo.switchNamePrefix + "1"
|
||||
|
||||
def getMidL2RInterface(self, id):
|
||||
return self.getMidLeftName(id) + "-eth1"
|
||||
|
@ -1,15 +1,15 @@
|
||||
from mpTopo import MpTopo
|
||||
from core.topo import Topo
|
||||
|
||||
class MpECMPSingleInterfaceTopo(MpTopo):
|
||||
class MpECMPSingleInterfaceTopo(Topo):
|
||||
def __init__(self, topoBuilder, parameterFile):
|
||||
MpTopo.__init__(self,topoBuilder, parameterFile)
|
||||
super().__init__(topoBuilder, parameterFile)
|
||||
|
||||
print("Hello ECMP topo")
|
||||
|
||||
self.client = self.addHost(MpTopo.clientName)
|
||||
self.server = self.addHost(MpTopo.serverName)
|
||||
self.lswitch = self.addSwitch(MpTopo.switchNamePrefix + "0")
|
||||
self.rswitch = self.addSwitch(MpTopo.switchNamePrefix + "1")
|
||||
self.client = self.addHost(Topo.clientName)
|
||||
self.server = self.addHost(Topo.serverName)
|
||||
self.lswitch = self.addSwitch(Topo.switchNamePrefix + "0")
|
||||
self.rswitch = self.addSwitch(Topo.switchNamePrefix + "1")
|
||||
|
||||
self.addLink( self.client, self.lswitch)
|
||||
self.addLink( self.server, self.rswitch)
|
||||
@ -22,7 +22,7 @@ class MpECMPSingleInterfaceTopo(MpTopo):
|
||||
self.addLink(self.rswitch, self.routers[-1], **l.asDict())
|
||||
|
||||
def addOneRouterPerLink(self, link):
|
||||
return self.addHost(MpTopo.routerNamePrefix +
|
||||
return self.addHost(Topo.routerNamePrefix +
|
||||
str(link.id))
|
||||
|
||||
def __str__(self):
|
||||
|
@ -1,24 +1,23 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpPvAt import MpPvAt
|
||||
import os
|
||||
|
||||
class MpExperienceAb(MpExperience):
|
||||
class ExperienceAb(Experience):
|
||||
SERVER_LOG = "ab_server.log"
|
||||
CLIENT_LOG = "ab_client.log"
|
||||
AB_BIN = "ab"
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client,
|
||||
"rm " + MpExperienceAb.PING_OUTPUT)
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
"rm " + ExperienceAb.PING_OUTPUT)
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -26,7 +25,7 @@ class MpExperienceAb(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceAb.PING_OUTPUT
|
||||
" >> " + ExperienceAb.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -34,17 +33,17 @@ class MpExperienceAb(MpExperience):
|
||||
"""
|
||||
todo : param LD_PRELOAD ??
|
||||
"""
|
||||
self.file = self.xpParam.getParam(MpParamXp.HTTPFILE)
|
||||
self.random_size = self.xpParam.getParam(MpParamXp.HTTPRANDOMSIZE)
|
||||
self.concurrent_requests = self.xpParam.getParam(MpParamXp.ABCONCURRENTREQUESTS)
|
||||
self.timelimit = self.xpParam.getParam(MpParamXp.ABTIMELIMIT)
|
||||
self.file = self.xpParam.getParam(ExperienceParameter.HTTPFILE)
|
||||
self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPRANDOMSIZE)
|
||||
self.concurrent_requests = self.xpParam.getParam(ExperienceParameter.ABCONCURRENTREQUESTS)
|
||||
self.timelimit = self.xpParam.getParam(ExperienceParameter.ABTIMELIMIT)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceAb.CLIENT_LOG )
|
||||
ExperienceAb.CLIENT_LOG )
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceAb.SERVER_LOG )
|
||||
ExperienceAb.SERVER_LOG )
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client,
|
||||
"dd if=/dev/urandom of=random bs=1K count=" + \
|
||||
@ -52,19 +51,19 @@ class MpExperienceAb(MpExperience):
|
||||
|
||||
def getAbServerCmd(self):
|
||||
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||
"/http.py &>" + MpExperienceAb.SERVER_LOG + "&"
|
||||
"/http.py &>" + ExperienceAb.SERVER_LOG + "&"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getAbClientCmd(self):
|
||||
s = MpExperienceAb.AB_BIN + " -c " + self.concurrent_requests + " -t " + \
|
||||
s = ExperienceAb.AB_BIN + " -c " + self.concurrent_requests + " -t " + \
|
||||
self.timelimit + " http://" + self.mpConfig.getServerIP() + "/" + self.file + \
|
||||
" &>" + MpExperienceAb.CLIENT_LOG
|
||||
" &>" + ExperienceAb.CLIENT_LOG
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
||||
#todo use cst
|
||||
|
@ -1,9 +1,8 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpPvAt import MpPvAt
|
||||
import os
|
||||
|
||||
class MpExperienceDITG(MpExperience):
|
||||
class ExperienceDITG(Experience):
|
||||
DITG_LOG = "ditg.log"
|
||||
DITG_SERVER_LOG = "ditg_server.log"
|
||||
ITGDEC_BIN = "/home/mininet/D-ITG-2.8.1-r1023/bin/ITGDec"
|
||||
@ -15,15 +14,15 @@ class MpExperienceDITG(MpExperience):
|
||||
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceDITG.PING_OUTPUT)
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperienceDITG.PING_OUTPUT)
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -31,7 +30,7 @@ class MpExperienceDITG(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceDITG.PING_OUTPUT
|
||||
" >> " + ExperienceDITG.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -39,22 +38,22 @@ class MpExperienceDITG(MpExperience):
|
||||
"""
|
||||
todo : param LD_PRELOAD ??
|
||||
"""
|
||||
self.kbytes = self.xpParam.getParam(MpParamXp.DITGKBYTES)
|
||||
self.constant_packet_size = self.xpParam.getParam(MpParamXp.DITGCONSTANTPACKETSIZE)
|
||||
self.mean_poisson_packets_sec = self.xpParam.getParam(MpParamXp.DITGMEANPOISSONPACKETSSEC)
|
||||
self.constant_packets_sec = self.xpParam.getParam(MpParamXp.DITGCONSTANTPACKETSSEC)
|
||||
self.bursts_on_packets_sec = self.xpParam.getParam(MpParamXp.DITGBURSTSONPACKETSSEC)
|
||||
self.bursts_off_packets_sec = self.xpParam.getParam(MpParamXp.DITGBURSTSOFFPACKETSSEC)
|
||||
self.kbytes = self.xpParam.getParam(ExperienceParameter.DITGKBYTES)
|
||||
self.constant_packet_size = self.xpParam.getParam(ExperienceParameter.DITGCONSTANTPACKETSIZE)
|
||||
self.mean_poisson_packets_sec = self.xpParam.getParam(ExperienceParameter.DITGMEANPOISSONPACKETSSEC)
|
||||
self.constant_packets_sec = self.xpParam.getParam(ExperienceParameter.DITGCONSTANTPACKETSSEC)
|
||||
self.bursts_on_packets_sec = self.xpParam.getParam(ExperienceParameter.DITGBURSTSONPACKETSSEC)
|
||||
self.bursts_off_packets_sec = self.xpParam.getParam(ExperienceParameter.DITGBURSTSOFFPACKETSSEC)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + MpExperienceDITG.DITG_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + MpExperienceDITG.DITG_SERVER_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + MpExperienceDITG.DITG_TEMP_LOG)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + ExperienceDITG.DITG_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + ExperienceDITG.DITG_SERVER_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + ExperienceDITG.DITG_TEMP_LOG)
|
||||
|
||||
def getClientCmd(self):
|
||||
s = MpExperienceDITG.ITGSEND_BIN + " -a " + self.mpConfig.getServerIP() + \
|
||||
" -T TCP -k " + self.kbytes + " -l " + MpExperienceDITG.DITG_TEMP_LOG
|
||||
s = ExperienceDITG.ITGSEND_BIN + " -a " + self.mpConfig.getServerIP() + \
|
||||
" -T TCP -k " + self.kbytes + " -l " + ExperienceDITG.DITG_TEMP_LOG
|
||||
|
||||
if self.constant_packet_size != "0":
|
||||
s += " -c " + self.constant_packet_size
|
||||
@ -65,17 +64,17 @@ class MpExperienceDITG(MpExperience):
|
||||
elif self.bursts_on_packets_sec != "0" and self.bursts_off_packets_sec != "0":
|
||||
s += " -B C " + self.bursts_on_packets_sec + " C " + self.bursts_off_packets_sec
|
||||
|
||||
s += " && " + MpExperienceDITG.ITGDEC_BIN + " " + MpExperienceDITG.DITG_TEMP_LOG + " &> " + MpExperienceDITG.DITG_LOG
|
||||
s += " && " + ExperienceDITG.ITGDEC_BIN + " " + ExperienceDITG.DITG_TEMP_LOG + " &> " + ExperienceDITG.DITG_LOG
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getServerCmd(self):
|
||||
s = MpExperienceDITG.ITGRECV_BIN + " -l " + MpExperienceDITG.DITG_SERVER_TEMP_LOG + " &"
|
||||
s = ExperienceDITG.ITGRECV_BIN + " -l " + ExperienceDITG.DITG_SERVER_TEMP_LOG + " &"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
#todo use cst
|
||||
#self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
||||
|
||||
@ -88,5 +87,5 @@ class MpExperienceDITG(MpExperience):
|
||||
cmd = self.getClientCmd()
|
||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "pkill -9 -f ITGRecv")
|
||||
self.mpTopo.commandTo(self.mpConfig.server, MpExperienceDITG.ITGDEC_BIN + " " + MpExperienceDITG.DITG_SERVER_TEMP_LOG + " &> " + MpExperienceDITG.DITG_SERVER_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, ExperienceDITG.ITGDEC_BIN + " " + ExperienceDITG.DITG_SERVER_TEMP_LOG + " &> " + ExperienceDITG.DITG_SERVER_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
||||
|
@ -1,9 +1,8 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpPvAt import MpPvAt
|
||||
import os
|
||||
|
||||
class MpExperienceEpload(MpExperience):
|
||||
class ExperienceEpload(Experience):
|
||||
SERVER_LOG = "http_server.log"
|
||||
EPLOAD_LOG = "epload.log"
|
||||
NODE_BIN = "/usr/local/nodejs/bin/node"
|
||||
@ -11,15 +10,15 @@ class MpExperienceEpload(MpExperience):
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceEpload.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperienceEpload.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -27,22 +26,22 @@ class MpExperienceEpload(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceEpload.PING_OUTPUT
|
||||
" >> " + ExperienceEpload.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def loadParam(self):
|
||||
self.epload_test_dir = self.xpParam.getParam(MpParamXp.EPLOADTESTDIR)
|
||||
self.epload_test_dir = self.xpParam.getParam(ExperienceParameter.EPLOADTESTDIR)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceEpload.EPLOAD_LOG )
|
||||
ExperienceEpload.EPLOAD_LOG )
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceEpload.SERVER_LOG )
|
||||
ExperienceEpload.SERVER_LOG )
|
||||
|
||||
def getHTTPServerCmd(self):
|
||||
s = "/etc/init.d/apache2 restart &>" + MpExperienceEpload.SERVER_LOG + " &"
|
||||
s = "/etc/init.d/apache2 restart &>" + ExperienceEpload.SERVER_LOG + " &"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -52,9 +51,9 @@ class MpExperienceEpload(MpExperience):
|
||||
return s
|
||||
|
||||
def getEploadClientCmd(self):
|
||||
s = MpExperienceEpload.NODE_BIN + " " + MpExperienceEpload.EPLOAD_EMULATOR + \
|
||||
s = ExperienceEpload.NODE_BIN + " " + ExperienceEpload.EPLOAD_EMULATOR + \
|
||||
" http " + \
|
||||
self.epload_test_dir + " &>" + MpExperienceEpload.EPLOAD_LOG
|
||||
self.epload_test_dir + " &>" + ExperienceEpload.EPLOAD_LOG
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -73,7 +72,7 @@ class MpExperienceEpload(MpExperience):
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
|
||||
def run(self):
|
||||
cmd = self.getHTTPServerCmd()
|
||||
|
@ -1,24 +1,23 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpPvAt import MpPvAt
|
||||
import os
|
||||
|
||||
class MpExperienceHTTP(MpExperience):
|
||||
class ExperienceHTTP(Experience):
|
||||
SERVER_LOG = "http_server.log"
|
||||
CLIENT_LOG = "http_client.log"
|
||||
WGET_BIN = "wget"
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceHTTP.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperienceHTTP.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -26,7 +25,7 @@ class MpExperienceHTTP(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceHTTP.PING_OUTPUT
|
||||
" >> " + ExperienceHTTP.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -34,33 +33,33 @@ class MpExperienceHTTP(MpExperience):
|
||||
"""
|
||||
todo : param LD_PRELOAD ??
|
||||
"""
|
||||
self.file = self.xpParam.getParam(MpParamXp.HTTPFILE)
|
||||
self.random_size = self.xpParam.getParam(MpParamXp.HTTPRANDOMSIZE)
|
||||
self.file = self.xpParam.getParam(ExperienceParameter.HTTPFILE)
|
||||
self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPRANDOMSIZE)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceHTTP.CLIENT_LOG )
|
||||
ExperienceHTTP.CLIENT_LOG )
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceHTTP.SERVER_LOG )
|
||||
ExperienceHTTP.SERVER_LOG )
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client,
|
||||
"dd if=/dev/urandom of=random bs=1K count=" + \
|
||||
self.random_size)
|
||||
|
||||
def getHTTPServerCmd(self):
|
||||
s = "/etc/init.d/apache2 restart &>" + MpExperienceHTTP.SERVER_LOG + "&"
|
||||
s = "/etc/init.d/apache2 restart &>" + ExperienceHTTP.SERVER_LOG + "&"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getHTTPClientCmd(self):
|
||||
s = "(time " + MpExperienceHTTP.WGET_BIN + " http://" + self.mpConfig.getServerIP() + \
|
||||
"/" + self.file + " --no-check-certificate) &>" + MpExperienceHTTP.CLIENT_LOG
|
||||
s = "(time " + ExperienceHTTP.WGET_BIN + " http://" + self.mpConfig.getServerIP() + \
|
||||
"/" + self.file + " --no-check-certificate) &>" + ExperienceHTTP.CLIENT_LOG
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
||||
#todo use cst
|
||||
|
@ -1,24 +1,23 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpPvAt import MpPvAt
|
||||
import os
|
||||
|
||||
class MpExperienceHTTPS(MpExperience):
|
||||
class ExperienceHTTPS(Experience):
|
||||
SERVER_LOG = "https_server.log"
|
||||
CLIENT_LOG = "https_client.log"
|
||||
WGET_BIN = "wget"
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceHTTPS.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperienceHTTPS.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -26,7 +25,7 @@ class MpExperienceHTTPS(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceHTTPS.PING_OUTPUT
|
||||
" >> " + ExperienceHTTPS.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -34,15 +33,15 @@ class MpExperienceHTTPS(MpExperience):
|
||||
"""
|
||||
todo : param LD_PRELOAD ??
|
||||
"""
|
||||
self.file = self.xpParam.getParam(MpParamXp.HTTPSFILE)
|
||||
self.random_size = self.xpParam.getParam(MpParamXp.HTTPSRANDOMSIZE)
|
||||
self.file = self.xpParam.getParam(ExperienceParameter.HTTPSFILE)
|
||||
self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPSRANDOMSIZE)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceHTTPS.CLIENT_LOG )
|
||||
ExperienceHTTPS.CLIENT_LOG )
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceHTTPS.SERVER_LOG )
|
||||
ExperienceHTTPS.SERVER_LOG )
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client,
|
||||
"dd if=/dev/urandom of=random bs=1K count=" + \
|
||||
@ -50,18 +49,18 @@ class MpExperienceHTTPS(MpExperience):
|
||||
|
||||
def getHTTPSServerCmd(self):
|
||||
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||
"/https.py &>" + MpExperienceHTTPS.SERVER_LOG + "&"
|
||||
"/https.py &>" + ExperienceHTTPS.SERVER_LOG + "&"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getHTTPSClientCmd(self):
|
||||
s = "(time " +MpExperienceHTTPS.WGET_BIN + " https://" + self.mpConfig.getServerIP() + \
|
||||
"/" + self.file + " --no-check-certificate) &>" + MpExperienceHTTPS.CLIENT_LOG
|
||||
s = "(time " +ExperienceHTTPS.WGET_BIN + " https://" + self.mpConfig.getServerIP() + \
|
||||
"/" + self.file + " --no-check-certificate) &>" + ExperienceHTTPS.CLIENT_LOG
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
||||
#todo use cst
|
||||
|
@ -1,24 +1,23 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpPvAt import MpPvAt
|
||||
import os
|
||||
|
||||
class MpExperienceIperf(MpExperience):
|
||||
class ExperienceIperf(Experience):
|
||||
IPERF_LOG = "iperf.log"
|
||||
SERVER_LOG = "server.log"
|
||||
IPERF_BIN = "iperf3"
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceIperf.PING_OUTPUT)
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperienceIperf.PING_OUTPUT)
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -26,7 +25,7 @@ class MpExperienceIperf(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceIperf.PING_OUTPUT
|
||||
" >> " + ExperienceIperf.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -34,30 +33,30 @@ class MpExperienceIperf(MpExperience):
|
||||
"""
|
||||
todo : param LD_PRELOAD ??
|
||||
"""
|
||||
self.time = self.xpParam.getParam(MpParamXp.IPERFTIME)
|
||||
self.parallel = self.xpParam.getParam(MpParamXp.IPERFPARALLEL)
|
||||
self.time = self.xpParam.getParam(ExperienceParameter.IPERFTIME)
|
||||
self.parallel = self.xpParam.getParam(ExperienceParameter.IPERFPARALLEL)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " +
|
||||
MpExperienceIperf.IPERF_LOG)
|
||||
ExperienceIperf.IPERF_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " +
|
||||
MpExperienceIperf.SERVER_LOG)
|
||||
ExperienceIperf.SERVER_LOG)
|
||||
|
||||
def getClientCmd(self):
|
||||
s = MpExperienceIperf.IPERF_BIN + " -c " + self.mpConfig.getServerIP() + \
|
||||
" -t " + self.time + " -P " + self.parallel + " &>" + MpExperienceIperf.IPERF_LOG
|
||||
s = ExperienceIperf.IPERF_BIN + " -c " + self.mpConfig.getServerIP() + \
|
||||
" -t " + self.time + " -P " + self.parallel + " &>" + ExperienceIperf.IPERF_LOG
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getServerCmd(self):
|
||||
s = "sudo " + MpExperienceIperf.IPERF_BIN + " -s &>" + \
|
||||
MpExperienceIperf.SERVER_LOG + "&"
|
||||
s = "sudo " + ExperienceIperf.IPERF_BIN + " -s &>" + \
|
||||
ExperienceIperf.SERVER_LOG + "&"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
#todo use cst
|
||||
#self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
||||
|
||||
|
@ -1,23 +1,22 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
import os
|
||||
|
||||
class MpExperienceMsg(MpExperience):
|
||||
class ExperienceMsg(Experience):
|
||||
SERVER_LOG = "msg_server.log"
|
||||
CLIENT_LOG = "msg_client.log"
|
||||
CLIENT_ERR = "msg_client.err"
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceMsg.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperienceMsg.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -25,7 +24,7 @@ class MpExperienceMsg(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceMsg.PING_OUTPUT
|
||||
" >> " + ExperienceMsg.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -33,33 +32,33 @@ class MpExperienceMsg(MpExperience):
|
||||
"""
|
||||
todo : param LD_PRELOAD ??
|
||||
"""
|
||||
self.client_sleep = self.xpParam.getParam(MpParamXp.MSGCLIENTSLEEP)
|
||||
self.server_sleep = self.xpParam.getParam(MpParamXp.MSGSERVERSLEEP)
|
||||
self.nb_requests = self.xpParam.getParam(MpParamXp.MSGNBREQUESTS)
|
||||
self.bytes = self.xpParam.getParam(MpParamXp.MSGBYTES)
|
||||
self.client_sleep = self.xpParam.getParam(ExperienceParameter.MSGCLIENTSLEEP)
|
||||
self.server_sleep = self.xpParam.getParam(ExperienceParameter.MSGSERVERSLEEP)
|
||||
self.nb_requests = self.xpParam.getParam(ExperienceParameter.MSGNBREQUESTS)
|
||||
self.bytes = self.xpParam.getParam(ExperienceParameter.MSGBYTES)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceMsg.CLIENT_LOG)
|
||||
ExperienceMsg.CLIENT_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceMsg.SERVER_LOG)
|
||||
ExperienceMsg.SERVER_LOG)
|
||||
|
||||
def getMsgServerCmd(self):
|
||||
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||
"/msg_server.py --sleep " + self.server_sleep + " --bytes " + self.bytes + " &>" + MpExperienceMsg.SERVER_LOG + "&"
|
||||
"/msg_server.py --sleep " + self.server_sleep + " --bytes " + self.bytes + " &>" + ExperienceMsg.SERVER_LOG + "&"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getMsgClientCmd(self):
|
||||
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||
"/msg_client.py --sleep " + self.client_sleep + " --nb " + self.nb_requests + \
|
||||
" --bytes " + self.bytes + " >" + MpExperienceMsg.CLIENT_LOG + " 2>" + MpExperienceMsg.CLIENT_ERR
|
||||
" --bytes " + self.bytes + " >" + ExperienceMsg.CLIENT_LOG + " 2>" + ExperienceMsg.CLIENT_ERR
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
|
||||
|
||||
def run(self):
|
||||
|
@ -1,67 +1,66 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpPvAt import MpPvAt
|
||||
|
||||
"""
|
||||
Should be the mother of MpExperienceNCPV, shame on me, should rewrite
|
||||
MpExperienceNCPV as daughter class of this one.
|
||||
Should be the mother of ExperienceNCPV, shame on me, should rewrite
|
||||
ExperienceNCPV as daughter class of this one.
|
||||
"""
|
||||
|
||||
class MpExperienceNC(MpExperience):
|
||||
class ExperienceNC(Experience):
|
||||
SERVER_NC_LOG = "netcat_server"
|
||||
CLIENT_NC_LOG = "netcat_client"
|
||||
NC_BIN = "netcat"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def loadParam(self):
|
||||
self.ddibs = self.xpParam.getParam(MpParamXp.DDIBS)
|
||||
self.ddobs = self.xpParam.getParam(MpParamXp.DDOBS)
|
||||
self.ddcount = self.xpParam.getParam(MpParamXp.DDCOUNT)
|
||||
self.ncServerPort = self.xpParam.getParam(MpParamXp.NCSERVERPORT)
|
||||
self.ddibs = self.xpParam.getParam(ExperienceParameter.DDIBS)
|
||||
self.ddobs = self.xpParam.getParam(ExperienceParameter.DDOBS)
|
||||
self.ddcount = self.xpParam.getParam(ExperienceParameter.DDCOUNT)
|
||||
self.ncServerPort = self.xpParam.getParam(ExperienceParameter.NCSERVERPORT)
|
||||
self.ncClientPort = []
|
||||
for k in sorted(self.xpParam.paramDic):
|
||||
if k.startswith(MpParamXp.NCCLIENTPORT):
|
||||
if k.startswith(ExperienceParameter.NCCLIENTPORT):
|
||||
port = self.xpParam.paramDic[k]
|
||||
self.ncClientPort.append(port)
|
||||
if len(self.ncClientPort) == 0:
|
||||
d = self.xpParam.getParam(MpParamXp.NCCLIENTPORT)
|
||||
d = self.xpParam.getParam(ExperienceParameter.NCCLIENTPORT)
|
||||
self.ncClientPort.append(d)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceNC.CLIENT_NC_LOG )
|
||||
ExperienceNC.CLIENT_NC_LOG )
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceNC.SERVER_NC_LOG )
|
||||
ExperienceNC.SERVER_NC_LOG )
|
||||
|
||||
def getNCServerCmd(self, id):
|
||||
s = "dd if=/dev/urandom ibs=" + self.ddibs + \
|
||||
" obs=" + self.ddobs + \
|
||||
" count=" + self.ddcount + \
|
||||
" | " + \
|
||||
MpExperienceNC.NC_BIN + \
|
||||
ExperienceNC.NC_BIN + \
|
||||
" -l " + self.ncServerPort + \
|
||||
" &>" + MpExperienceNC.SERVER_NC_LOG + \
|
||||
" &>" + ExperienceNC.SERVER_NC_LOG + \
|
||||
"_" + str(id) + ".log"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getNCClientCmd(self, id):
|
||||
s = MpExperienceNC.NC_BIN + " " + \
|
||||
s = ExperienceNC.NC_BIN + " " + \
|
||||
" -p " + self.ncClientPort[id] + " " + \
|
||||
self.mpConfig.getServerIP() + " " + \
|
||||
self.ncServerPort + " " + \
|
||||
"&>" + MpExperienceNC.CLIENT_NC_LOG + \
|
||||
"&>" + ExperienceNC.CLIENT_NC_LOG + \
|
||||
"_" + str(id) + ".log"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
#todo use cst
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpPvAt import MpPvAt
|
||||
|
||||
class MpExperienceNCPV(MpExperience):
|
||||
class ExperienceNCPV(Experience):
|
||||
"""
|
||||
NC PV : NetCat and Pipe Viewer
|
||||
"""
|
||||
@ -13,15 +12,15 @@ class MpExperienceNCPV(MpExperience):
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceNCPV.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperienceNCPV.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -29,36 +28,36 @@ class MpExperienceNCPV(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceNCPV.PING_OUTPUT
|
||||
" >> " + ExperienceNCPV.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def loadParam(self):
|
||||
self.pvg = self.xpParam.getParam(MpParamXp.PVG)
|
||||
self.pvz = self.xpParam.getParam(MpParamXp.PVZ)
|
||||
self.pvRateLimit = self.xpParam.getParam(MpParamXp.PVRATELIMIT)
|
||||
self.ddibs = self.xpParam.getParam(MpParamXp.DDIBS)
|
||||
self.ddobs = self.xpParam.getParam(MpParamXp.DDOBS)
|
||||
self.ddcount = self.xpParam.getParam(MpParamXp.DDCOUNT)
|
||||
self.ncServerPort = self.xpParam.getParam(MpParamXp.NCSERVERPORT)
|
||||
self.pvRateLimit = self.xpParam.getParam(MpParamXp.PVRATELIMIT)
|
||||
self.pvg = self.xpParam.getParam(ExperienceParameter.PVG)
|
||||
self.pvz = self.xpParam.getParam(ExperienceParameter.PVZ)
|
||||
self.pvRateLimit = self.xpParam.getParam(ExperienceParameter.PVRATELIMIT)
|
||||
self.ddibs = self.xpParam.getParam(ExperienceParameter.DDIBS)
|
||||
self.ddobs = self.xpParam.getParam(ExperienceParameter.DDOBS)
|
||||
self.ddcount = self.xpParam.getParam(ExperienceParameter.DDCOUNT)
|
||||
self.ncServerPort = self.xpParam.getParam(ExperienceParameter.NCSERVERPORT)
|
||||
self.pvRateLimit = self.xpParam.getParam(ExperienceParameter.PVRATELIMIT)
|
||||
self.ncClientPort = []
|
||||
for k in sorted(self.xpParam.paramDic):
|
||||
if k.startswith(MpParamXp.NCCLIENTPORT):
|
||||
if k.startswith(ExperienceParameter.NCCLIENTPORT):
|
||||
port = self.xpParam.paramDic[k]
|
||||
self.ncClientPort.append(port)
|
||||
if len(self.ncClientPort) == 0:
|
||||
d = self.xpParam.getParam(MpParamXp.NCCLIENTPORT)
|
||||
d = self.xpParam.getParam(ExperienceParameter.NCCLIENTPORT)
|
||||
self.ncClientPort.append(d)
|
||||
self.loadPvAt()
|
||||
|
||||
def loadPvAt(self):
|
||||
self.changePvAt = []
|
||||
self.changePv = self.xpParam.getParam(MpParamXp.CHANGEPV)
|
||||
self.changePv = self.xpParam.getParam(ExperienceParameter.CHANGEPV)
|
||||
if self.changePv != "yes":
|
||||
print("Don't change pv rate...")
|
||||
return
|
||||
changePvAt = self.xpParam.getParam(MpParamXp.CHANGEPVAT)
|
||||
changePvAt = self.xpParam.getParam(ExperienceParameter.CHANGEPVAT)
|
||||
if not isinstance(changePvAt, list):
|
||||
changePvAt = [changePvAt]
|
||||
for p in changePvAt:
|
||||
@ -67,7 +66,7 @@ class MpExperienceNCPV(MpExperience):
|
||||
o = MpPvAt(float(tab[0]), tab[1])
|
||||
self.addPvAt(o)
|
||||
else:
|
||||
print("pv wrong line : " + n)
|
||||
print("pv wrong line : " + p)
|
||||
|
||||
def addPvAt(self, p):
|
||||
if len(self.changePvAt) == 0 :
|
||||
@ -87,22 +86,22 @@ class MpExperienceNCPV(MpExperience):
|
||||
for p in self.changePvAt:
|
||||
cmd = cmd + "sleep " + str(p.delta)
|
||||
cmd = cmd + " && "
|
||||
cmd = cmd + MpExperienceNCPV.PV_BIN + " -R " + self.pvPid
|
||||
cmd = cmd + ExperienceNCPV.PV_BIN + " -R " + self.pvPid
|
||||
cmd = cmd + " " + p.cmd + " && "
|
||||
cmd = cmd + " true &"
|
||||
return cmd
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceNCPV.CLIENT_NC_LOG )
|
||||
ExperienceNCPV.CLIENT_NC_LOG )
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceNCPV.SERVER_NC_LOG )
|
||||
ExperienceNCPV.SERVER_NC_LOG )
|
||||
|
||||
def getNCServerCmd(self, id):
|
||||
s = MpExperienceNCPV.NC_BIN + " -d " + \
|
||||
s = ExperienceNCPV.NC_BIN + " -d " + \
|
||||
" -l " + self.ncServerPort + \
|
||||
" 1>/dev/null 2>" + MpExperienceNCPV.SERVER_NC_LOG + \
|
||||
" 1>/dev/null 2>" + ExperienceNCPV.SERVER_NC_LOG + \
|
||||
"_" + str(id) + ".log &"
|
||||
print(s)
|
||||
return s
|
||||
@ -111,14 +110,14 @@ class MpExperienceNCPV(MpExperience):
|
||||
s = "dd if=/dev/urandom ibs=" + self.ddibs + \
|
||||
" obs=" + self.ddobs + \
|
||||
" count=" + self.ddcount + \
|
||||
" | " + MpExperienceNCPV.PV_BIN + \
|
||||
" | " + ExperienceNCPV.PV_BIN + \
|
||||
" -g " + self.pvg + " -z " + self.pvz + \
|
||||
" -q --rate-limit " + self.pvRateLimit + \
|
||||
" | " + MpExperienceNCPV.NC_BIN + " " + \
|
||||
" | " + ExperienceNCPV.NC_BIN + " " + \
|
||||
" -p " + self.ncClientPort[id] + " " + \
|
||||
self.mpConfig.getServerIP() + " " + \
|
||||
self.ncServerPort + " " + \
|
||||
"&>" + MpExperienceNCPV.CLIENT_NC_LOG + \
|
||||
"&>" + ExperienceNCPV.CLIENT_NC_LOG + \
|
||||
"_" + str(id) + ".log"
|
||||
print(s)
|
||||
return s
|
||||
@ -127,7 +126,7 @@ class MpExperienceNCPV(MpExperience):
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
#todo use cst
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpPvAt import MpPvAt
|
||||
import os
|
||||
|
||||
class MpExperienceNetperf(MpExperience):
|
||||
class ExperienceNetperf(Experience):
|
||||
NETPERF_LOG = "netperf.log"
|
||||
NETSERVER_LOG = "netserver.log"
|
||||
NETPERF_BIN = "netperf"
|
||||
@ -11,15 +10,15 @@ class MpExperienceNetperf(MpExperience):
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceNetperf.PING_OUTPUT)
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperienceNetperf.PING_OUTPUT)
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -27,7 +26,7 @@ class MpExperienceNetperf(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceNetperf.PING_OUTPUT
|
||||
" >> " + ExperienceNetperf.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -35,32 +34,32 @@ class MpExperienceNetperf(MpExperience):
|
||||
"""
|
||||
todo : param LD_PRELOAD ??
|
||||
"""
|
||||
self.testlen = self.xpParam.getParam(MpParamXp.NETPERFTESTLEN)
|
||||
self.testname = self.xpParam.getParam(MpParamXp.NETPERFTESTNAME)
|
||||
self.reqres_size = self.xpParam.getParam(MpParamXp.NETPERFREQRESSIZE)
|
||||
self.testlen = self.xpParam.getParam(ExperienceParameter.NETPERFTESTLEN)
|
||||
self.testname = self.xpParam.getParam(ExperienceParameter.NETPERFTESTNAME)
|
||||
self.reqres_size = self.xpParam.getParam(ExperienceParameter.NETPERFREQRESSIZE)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " +
|
||||
MpExperienceNetperf.NETPERF_LOG)
|
||||
ExperienceNetperf.NETPERF_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " +
|
||||
MpExperienceNetperf.NETSERVER_LOG)
|
||||
ExperienceNetperf.NETSERVER_LOG)
|
||||
|
||||
def getClientCmd(self):
|
||||
s = MpExperienceNetperf.NETPERF_BIN + " -H " + self.mpConfig.getServerIP() + \
|
||||
s = ExperienceNetperf.NETPERF_BIN + " -H " + self.mpConfig.getServerIP() + \
|
||||
" -l " + self.testlen + " -t " + self.testname + " -- -r " + self.reqres_size + \
|
||||
" &>" + MpExperienceNetperf.NETPERF_LOG
|
||||
" &>" + ExperienceNetperf.NETPERF_LOG
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getServerCmd(self):
|
||||
s = "sudo " + MpExperienceNetperf.NETSERVER_BIN + " &>" + \
|
||||
MpExperienceNetperf.NETSERVER_LOG + "&"
|
||||
s = "sudo " + ExperienceNetperf.NETSERVER_BIN + " &>" + \
|
||||
ExperienceNetperf.NETSERVER_LOG + "&"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
#todo use cst
|
||||
#self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
||||
|
||||
|
@ -1,16 +1,15 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
|
||||
class MpExperienceNone(MpExperience):
|
||||
class ExperienceNone(Experience):
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
MpExperience.classicRun(self)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
|
||||
def run(self):
|
||||
self.mpTopo.getCLI()
|
||||
|
@ -1,23 +1,22 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
|
||||
class MpExperiencePing(MpExperience):
|
||||
class ExperiencePing(Experience):
|
||||
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
MpExperience.classicRun(self)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.classicRun(self)
|
||||
def prepapre(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
|
||||
def run(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperiencePing.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperiencePing.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -25,6 +24,6 @@ class MpExperiencePing(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperiencePing.PING_OUTPUT
|
||||
" >> " + ExperiencePing.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
@ -1,10 +1,9 @@
|
||||
from mpExperience import MpExperience
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpMultiInterfaceCongConfig import MpMultiInterfaceCongConfig
|
||||
from mpParamXp import MpParamXp
|
||||
import os
|
||||
|
||||
|
||||
class MpExperienceQUIC(MpExperience):
|
||||
class ExperienceQUIC(Experience):
|
||||
GO_BIN = "/usr/local/go/bin/go"
|
||||
WGET = "~/git/wget/src/wget"
|
||||
SERVER_LOG = "quic_server.log"
|
||||
@ -15,15 +14,15 @@ class MpExperienceQUIC(MpExperience):
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceQUIC.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperienceQUIC.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -31,7 +30,7 @@ class MpExperienceQUIC(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceQUIC.PING_OUTPUT
|
||||
" >> " + ExperienceQUIC.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -39,33 +38,33 @@ class MpExperienceQUIC(MpExperience):
|
||||
"""
|
||||
todo : param LD_PRELOAD ??
|
||||
"""
|
||||
self.file = self.xpParam.getParam(MpParamXp.HTTPSFILE)
|
||||
self.random_size = self.xpParam.getParam(MpParamXp.HTTPSRANDOMSIZE)
|
||||
self.multipath = self.xpParam.getParam(MpParamXp.QUICMULTIPATH)
|
||||
self.file = self.xpParam.getParam(ExperienceParameter.HTTPSFILE)
|
||||
self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPSRANDOMSIZE)
|
||||
self.multipath = self.xpParam.getParam(ExperienceParameter.QUICMULTIPATH)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceQUIC.CLIENT_LOG )
|
||||
ExperienceQUIC.CLIENT_LOG )
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceQUIC.SERVER_LOG )
|
||||
ExperienceQUIC.SERVER_LOG )
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client,
|
||||
"dd if=/dev/urandom of=random bs=1K count=" + \
|
||||
self.random_size)
|
||||
|
||||
def getQUICServerCmd(self):
|
||||
s = MpExperienceQUIC.GO_BIN + " run " + MpExperienceQUIC.SERVER_GO_FILE
|
||||
s += " -www . -certpath " + MpExperienceQUIC.CERTPATH + " &>"
|
||||
s += MpExperienceQUIC.SERVER_LOG + " &"
|
||||
s = ExperienceQUIC.GO_BIN + " run " + ExperienceQUIC.SERVER_GO_FILE
|
||||
s += " -www . -certpath " + ExperienceQUIC.CERTPATH + " &>"
|
||||
s += ExperienceQUIC.SERVER_LOG + " &"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getQUICClientCmd(self):
|
||||
s = MpExperienceQUIC.GO_BIN + " run " + MpExperienceQUIC.CLIENT_GO_FILE
|
||||
s = ExperienceQUIC.GO_BIN + " run " + ExperienceQUIC.CLIENT_GO_FILE
|
||||
if int(self.multipath) > 0:
|
||||
s += " -m"
|
||||
s += " https://" + self.mpConfig.getServerIP() + ":6121/random &>" + MpExperienceQUIC.CLIENT_LOG
|
||||
s += " https://" + self.mpConfig.getServerIP() + ":6121/random &>" + ExperienceQUIC.CLIENT_LOG
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -76,13 +75,13 @@ class MpExperienceQUIC(MpExperience):
|
||||
return s
|
||||
|
||||
def getCongClientCmd(self, congID):
|
||||
s = "(time " + MpExperienceQUIC.WGET + " https://" + self.mpConfig.getCongServerIP(congID) +\
|
||||
s = "(time " + ExperienceQUIC.WGET + " https://" + self.mpConfig.getCongServerIP(congID) +\
|
||||
"/" + self.file + " --no-check-certificate --disable-mptcp) &> https_client" + str(congID) + ".log &"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
||||
#todo use cst
|
||||
@ -121,7 +120,7 @@ class MpExperienceQUIC(MpExperience):
|
||||
for cc in self.mpConfig.cong_clients:
|
||||
self.mpTopo.commandTo(cc, "while pkill -f wget -0; do sleep 0.5; done")
|
||||
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f " + MpExperienceQUIC.SERVER_GO_FILE)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f " + ExperienceQUIC.SERVER_GO_FILE)
|
||||
if isinstance(self.mpConfig, MpMultiInterfaceCongConfig):
|
||||
for cs in self.mpConfig.cong_servers:
|
||||
self.mpTopo.commandTo(cs, "pkill -f https.py")
|
||||
|
@ -1,9 +1,8 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
import os
|
||||
|
||||
|
||||
class MpExperienceQUICSiri(MpExperience):
|
||||
class ExperienceQUICSiri(Experience):
|
||||
GO_BIN = "/usr/local/go/bin/go"
|
||||
SERVER_LOG = "quic_server.log"
|
||||
CLIENT_LOG = "quic_client.log"
|
||||
@ -12,15 +11,15 @@ class MpExperienceQUICSiri(MpExperience):
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceQUICSiri.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperienceQUICSiri.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -28,7 +27,7 @@ class MpExperienceQUICSiri(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceQUICSiri.PING_OUTPUT
|
||||
" >> " + ExperienceQUICSiri.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -36,33 +35,33 @@ class MpExperienceQUICSiri(MpExperience):
|
||||
"""
|
||||
todo : param LD_PRELOAD ??
|
||||
"""
|
||||
self.run_time = self.xpParam.getParam(MpParamXp.QUICSIRIRUNTIME)
|
||||
self.multipath = self.xpParam.getParam(MpParamXp.QUICMULTIPATH)
|
||||
self.run_time = self.xpParam.getParam(ExperienceParameter.QUICSIRIRUNTIME)
|
||||
self.multipath = self.xpParam.getParam(ExperienceParameter.QUICMULTIPATH)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceQUICSiri.CLIENT_LOG )
|
||||
ExperienceQUICSiri.CLIENT_LOG )
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceQUICSiri.SERVER_LOG )
|
||||
ExperienceQUICSiri.SERVER_LOG )
|
||||
|
||||
def getQUICSiriServerCmd(self):
|
||||
s = MpExperienceQUICSiri.GO_BIN + " run " + MpExperienceQUICSiri.SERVER_GO_FILE
|
||||
s += " -addr 0.0.0.0:8080 &>" + MpExperienceQUICSiri.SERVER_LOG + " &"
|
||||
s = ExperienceQUICSiri.GO_BIN + " run " + ExperienceQUICSiri.SERVER_GO_FILE
|
||||
s += " -addr 0.0.0.0:8080 &>" + ExperienceQUICSiri.SERVER_LOG + " &"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getQUICSiriClientCmd(self):
|
||||
s = MpExperienceQUICSiri.GO_BIN + " run " + MpExperienceQUICSiri.CLIENT_GO_FILE
|
||||
s = ExperienceQUICSiri.GO_BIN + " run " + ExperienceQUICSiri.CLIENT_GO_FILE
|
||||
s += " -addr " + self.mpConfig.getServerIP() + ":8080 -runTime " + self.run_time + "s"
|
||||
if int(self.multipath) > 0:
|
||||
s += " -m"
|
||||
s += " &>" + MpExperienceQUICSiri.CLIENT_LOG
|
||||
s += " &>" + ExperienceQUICSiri.CLIENT_LOG
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
|
||||
|
||||
def run(self):
|
||||
@ -76,7 +75,7 @@ class MpExperienceQUICSiri(MpExperience):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after")
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after")
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f " + MpExperienceQUICSiri.SERVER_GO_FILE)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f " + ExperienceQUICSiri.SERVER_GO_FILE)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
||||
# Need to delete the go-build directory in tmp; could lead to no more space left error
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm -r /tmp/go-build*")
|
||||
|
@ -1,24 +1,23 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpPvAt import MpPvAt
|
||||
import os
|
||||
|
||||
class MpExperienceSendFile(MpExperience):
|
||||
class ExperienceSendFile(Experience):
|
||||
SERVER_LOG = "sendfile_server.log"
|
||||
CLIENT_LOG = "sendfile_client.log"
|
||||
WGET_BIN = "./client"
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceSendFile.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperienceSendFile.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -26,7 +25,7 @@ class MpExperienceSendFile(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceSendFile.PING_OUTPUT
|
||||
" >> " + ExperienceSendFile.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -34,32 +33,32 @@ class MpExperienceSendFile(MpExperience):
|
||||
"""
|
||||
todo : param LD_PRELOAD ??
|
||||
"""
|
||||
self.file = self.xpParam.getParam(MpParamXp.HTTPSFILE)
|
||||
self.random_size = self.xpParam.getParam(MpParamXp.HTTPSRANDOMSIZE)
|
||||
self.file = self.xpParam.getParam(ExperienceParameter.HTTPSFILE)
|
||||
self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPSRANDOMSIZE)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceSendFile.CLIENT_LOG )
|
||||
ExperienceSendFile.CLIENT_LOG )
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceSendFile.SERVER_LOG )
|
||||
ExperienceSendFile.SERVER_LOG )
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client,
|
||||
"dd if=/dev/urandom of=random bs=1K count=" + \
|
||||
self.random_size)
|
||||
|
||||
def getSendFileServerCmd(self):
|
||||
s = "./server &>" + MpExperienceSendFile.SERVER_LOG + "&"
|
||||
s = "./server &>" + ExperienceSendFile.SERVER_LOG + "&"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getSendFileClientCmd(self):
|
||||
s = MpExperienceSendFile.WGET_BIN + " " + self.mpConfig.getServerIP() + " &>" + MpExperienceSendFile.CLIENT_LOG
|
||||
s = ExperienceSendFile.WGET_BIN + " " + self.mpConfig.getServerIP() + " &>" + ExperienceSendFile.CLIENT_LOG
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
||||
#todo use cst
|
||||
|
@ -1,9 +1,8 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpPvAt import MpPvAt
|
||||
import os
|
||||
|
||||
class MpExperienceSiri(MpExperience):
|
||||
class ExperienceSiri(Experience):
|
||||
SERVER_LOG = "siri_server.log"
|
||||
CLIENT_LOG = "siri_client.log"
|
||||
CLIENT_ERR = "siri_client.err"
|
||||
@ -11,15 +10,15 @@ class MpExperienceSiri(MpExperience):
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceSiri.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperienceSiri.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -27,7 +26,7 @@ class MpExperienceSiri(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceSiri.PING_OUTPUT
|
||||
" >> " + ExperienceSiri.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -35,41 +34,41 @@ class MpExperienceSiri(MpExperience):
|
||||
"""
|
||||
todo : param LD_PRELOAD ??
|
||||
"""
|
||||
self.run_time = self.xpParam.getParam(MpParamXp.SIRIRUNTIME)
|
||||
self.query_size = self.xpParam.getParam(MpParamXp.SIRIQUERYSIZE)
|
||||
self.response_size = self.xpParam.getParam(MpParamXp.SIRIRESPONSESIZE)
|
||||
self.delay_query_response = self.xpParam.getParam(MpParamXp.SIRIDELAYQUERYRESPONSE)
|
||||
self.min_payload_size = self.xpParam.getParam(MpParamXp.SIRIMINPAYLOADSIZE)
|
||||
self.max_payload_size = self.xpParam.getParam(MpParamXp.SIRIMAXPAYLOADSIZE)
|
||||
self.interval_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALTIMEMS)
|
||||
self.buffer_size = self.xpParam.getParam(MpParamXp.SIRIBUFFERSIZE)
|
||||
self.burst_size = self.xpParam.getParam(MpParamXp.SIRIBURSTSIZE)
|
||||
self.interval_burst_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALBURSTTIMEMS)
|
||||
self.run_time = self.xpParam.getParam(ExperienceParameter.SIRIRUNTIME)
|
||||
self.query_size = self.xpParam.getParam(ExperienceParameter.SIRIQUERYSIZE)
|
||||
self.response_size = self.xpParam.getParam(ExperienceParameter.SIRIRESPONSESIZE)
|
||||
self.delay_query_response = self.xpParam.getParam(ExperienceParameter.SIRIDELAYQUERYRESPONSE)
|
||||
self.min_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMINPAYLOADSIZE)
|
||||
self.max_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMAXPAYLOADSIZE)
|
||||
self.interval_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALTIMEMS)
|
||||
self.buffer_size = self.xpParam.getParam(ExperienceParameter.SIRIBUFFERSIZE)
|
||||
self.burst_size = self.xpParam.getParam(ExperienceParameter.SIRIBURSTSIZE)
|
||||
self.interval_burst_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALBURSTTIMEMS)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceSiri.CLIENT_LOG)
|
||||
ExperienceSiri.CLIENT_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceSiri.SERVER_LOG)
|
||||
ExperienceSiri.SERVER_LOG)
|
||||
|
||||
def getSiriServerCmd(self):
|
||||
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||
"/siri_server.py &>" + MpExperienceSiri.SERVER_LOG + "&"
|
||||
"/siri_server.py &>" + ExperienceSiri.SERVER_LOG + "&"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getSiriClientCmd(self):
|
||||
s = MpExperienceSiri.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/siriClient.jar " + \
|
||||
s = ExperienceSiri.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/siriClient.jar " + \
|
||||
self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
|
||||
" " + self.delay_query_response + " " + self.min_payload_size + " " + \
|
||||
self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + " " + self.burst_size + " " + self.interval_burst_time_ms + \
|
||||
" >" + MpExperienceSiri.CLIENT_LOG + " 2>" + MpExperienceSiri.CLIENT_ERR
|
||||
" >" + ExperienceSiri.CLIENT_LOG + " 2>" + ExperienceSiri.CLIENT_ERR
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
|
||||
|
||||
def run(self):
|
||||
|
@ -1,9 +1,8 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpPvAt import MpPvAt
|
||||
import os
|
||||
|
||||
class MpExperienceSiriHTTP(MpExperience):
|
||||
class ExperienceSiriHTTP(Experience):
|
||||
HTTP_SERVER_LOG = "http_server.log"
|
||||
HTTP_CLIENT_LOG = "http_client.log"
|
||||
WGET_BIN = "wget"
|
||||
@ -14,15 +13,15 @@ class MpExperienceSiriHTTP(MpExperience):
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceSiriHTTP.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperienceSiriHTTP.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -30,7 +29,7 @@ class MpExperienceSiriHTTP(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceSiriHTTP.PING_OUTPUT
|
||||
" >> " + ExperienceSiriHTTP.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -38,29 +37,29 @@ class MpExperienceSiriHTTP(MpExperience):
|
||||
"""
|
||||
todo : param LD_PRELOAD ??
|
||||
"""
|
||||
self.run_time = self.xpParam.getParam(MpParamXp.SIRIRUNTIME)
|
||||
self.query_size = self.xpParam.getParam(MpParamXp.SIRIQUERYSIZE)
|
||||
self.response_size = self.xpParam.getParam(MpParamXp.SIRIRESPONSESIZE)
|
||||
self.delay_query_response = self.xpParam.getParam(MpParamXp.SIRIDELAYQUERYRESPONSE)
|
||||
self.min_payload_size = self.xpParam.getParam(MpParamXp.SIRIMINPAYLOADSIZE)
|
||||
self.max_payload_size = self.xpParam.getParam(MpParamXp.SIRIMAXPAYLOADSIZE)
|
||||
self.interval_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALTIMEMS)
|
||||
self.buffer_size = self.xpParam.getParam(MpParamXp.SIRIBUFFERSIZE)
|
||||
self.burst_size = self.xpParam.getParam(MpParamXp.SIRIBURSTSIZE)
|
||||
self.interval_burst_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALBURSTTIMEMS)
|
||||
self.file = self.xpParam.getParam(MpParamXp.HTTPFILE)
|
||||
self.random_size = self.xpParam.getParam(MpParamXp.HTTPRANDOMSIZE)
|
||||
self.run_time = self.xpParam.getParam(ExperienceParameter.SIRIRUNTIME)
|
||||
self.query_size = self.xpParam.getParam(ExperienceParameter.SIRIQUERYSIZE)
|
||||
self.response_size = self.xpParam.getParam(ExperienceParameter.SIRIRESPONSESIZE)
|
||||
self.delay_query_response = self.xpParam.getParam(ExperienceParameter.SIRIDELAYQUERYRESPONSE)
|
||||
self.min_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMINPAYLOADSIZE)
|
||||
self.max_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMAXPAYLOADSIZE)
|
||||
self.interval_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALTIMEMS)
|
||||
self.buffer_size = self.xpParam.getParam(ExperienceParameter.SIRIBUFFERSIZE)
|
||||
self.burst_size = self.xpParam.getParam(ExperienceParameter.SIRIBURSTSIZE)
|
||||
self.interval_burst_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALBURSTTIMEMS)
|
||||
self.file = self.xpParam.getParam(ExperienceParameter.HTTPFILE)
|
||||
self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPRANDOMSIZE)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceSiriHTTP.CLIENT_LOG)
|
||||
ExperienceSiriHTTP.CLIENT_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceSiriHTTP.SERVER_LOG)
|
||||
ExperienceSiriHTTP.SERVER_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceSiriHTTP.HTTP_CLIENT_LOG)
|
||||
ExperienceSiriHTTP.HTTP_CLIENT_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceSiriHTTP.HTTP_SERVER_LOG)
|
||||
ExperienceSiriHTTP.HTTP_SERVER_LOG)
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client,
|
||||
"dd if=/dev/urandom of=random bs=1K count=" + \
|
||||
@ -69,32 +68,32 @@ class MpExperienceSiriHTTP(MpExperience):
|
||||
|
||||
def getSiriServerCmd(self):
|
||||
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||
"/siri_server.py &>" + MpExperienceSiriHTTP.SERVER_LOG + "&"
|
||||
"/siri_server.py &>" + ExperienceSiriHTTP.SERVER_LOG + "&"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getSiriClientCmd(self):
|
||||
s = MpExperienceSiriHTTP.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/siriClient.jar " + \
|
||||
s = ExperienceSiriHTTP.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/siriClient.jar " + \
|
||||
self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
|
||||
" " + self.delay_query_response + " " + self.min_payload_size + " " + \
|
||||
self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + " " + self.burst_size + " " + self.interval_burst_time_ms + \
|
||||
" >" + MpExperienceSiriHTTP.CLIENT_LOG + " 2>" + MpExperienceSiriHTTP.CLIENT_ERR
|
||||
" >" + ExperienceSiriHTTP.CLIENT_LOG + " 2>" + ExperienceSiriHTTP.CLIENT_ERR
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getHTTPServerCmd(self):
|
||||
s = "/etc/init.d/apache2 restart &>" + MpExperienceSiriHTTP.SERVER_LOG + "&"
|
||||
s = "/etc/init.d/apache2 restart &>" + ExperienceSiriHTTP.SERVER_LOG + "&"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getHTTPClientCmd(self):
|
||||
s = MpExperienceSiriHTTP.WGET_BIN + " http://" + self.mpConfig.getServerIP() + \
|
||||
s = ExperienceSiriHTTP.WGET_BIN + " http://" + self.mpConfig.getServerIP() + \
|
||||
"/" + self.file + " --no-check-certificate"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpPvAt import MpPvAt
|
||||
import os
|
||||
|
||||
class MpExperienceSiriMsg(MpExperience):
|
||||
class ExperienceSiriMsg(Experience):
|
||||
MSG_SERVER_LOG = "msg_server.log"
|
||||
MSG_CLIENT_LOG = "msg_client.log"
|
||||
MSG_CLIENT_ERR = "msg_client.err"
|
||||
@ -14,14 +13,14 @@ class MpExperienceSiriMsg(MpExperience):
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceSiriMsg.PING_OUTPUT )
|
||||
ExperienceSiriMsg.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
@ -30,7 +29,7 @@ class MpExperienceSiriMsg(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceSiriMsg.PING_OUTPUT
|
||||
" >> " + ExperienceSiriMsg.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -53,50 +52,50 @@ class MpExperienceSiriMsg(MpExperience):
|
||||
self.nb_requests = self.xpParam.getParam(MpParamXp.MSGNBREQUESTS)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceSiriMsg.CLIENT_LOG)
|
||||
ExperienceSiriMsg.CLIENT_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceSiriMsg.CLIENT_ERR)
|
||||
ExperienceSiriMsg.CLIENT_ERR)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceSiriMsg.SERVER_LOG)
|
||||
ExperienceSiriMsg.SERVER_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceSiriMsg.MSG_CLIENT_LOG)
|
||||
ExperienceSiriMsg.MSG_CLIENT_LOG)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceSiriMsg.MSG_CLIENT_ERR)
|
||||
ExperienceSiriMsg.MSG_CLIENT_ERR)
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceSiriMsg.MSG_SERVER_LOG)
|
||||
ExperienceSiriMsg.MSG_SERVER_LOG)
|
||||
|
||||
def getSiriServerCmd(self):
|
||||
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||
"/siri_server.py &>" + MpExperienceSiriMsg.SERVER_LOG + "&"
|
||||
"/siri_server.py &>" + ExperienceSiriMsg.SERVER_LOG + "&"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getSiriClientCmd(self):
|
||||
s = MpExperienceSiriMsg.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/siriClient.jar " + \
|
||||
s = ExperienceSiriMsg.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/siriClient.jar " + \
|
||||
self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
|
||||
" " + self.delay_query_response + " " + self.min_payload_size + " " + \
|
||||
self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + " " + self.burst_size + " " + self.interval_burst_time_ms + \
|
||||
" >" + MpExperienceSiriMsg.CLIENT_LOG + " 2>" + MpExperienceSiriMsg.CLIENT_ERR
|
||||
" >" + ExperienceSiriMsg.CLIENT_LOG + " 2>" + ExperienceSiriMsg.CLIENT_ERR
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getMsgServerCmd(self):
|
||||
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||
"/msg_server.py --sleep " + self.server_sleep + " &>" + MpExperienceSiriMsg.MSG_SERVER_LOG + "&"
|
||||
"/msg_server.py --sleep " + self.server_sleep + " &>" + ExperienceSiriMsg.MSG_SERVER_LOG + "&"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getMsgClientCmd(self):
|
||||
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||
"/msg_client.py --sleep " + self.client_sleep + " --nb " + self.nb_requests + \
|
||||
" --bulk >" + MpExperienceSiriMsg.MSG_CLIENT_LOG + " 2>" + MpExperienceSiriMsg.MSG_CLIENT_ERR + "&"
|
||||
" --bulk >" + ExperienceSiriMsg.MSG_CLIENT_LOG + " 2>" + ExperienceSiriMsg.MSG_CLIENT_ERR + "&"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
|
||||
|
||||
def run(self):
|
||||
|
@ -1,24 +1,23 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter
|
||||
from mpPvAt import MpPvAt
|
||||
import os
|
||||
|
||||
class MpExperienceVLC(MpExperience):
|
||||
class ExperienceVLC(Experience):
|
||||
SERVER_LOG = "vlc_server.log"
|
||||
CLIENT_LOG = "vlc_client.log"
|
||||
VLC_BIN = "/home/mininet/vlc/vlc"
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
Experience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceVLC.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||
ExperienceVLC.PING_OUTPUT )
|
||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||
self.mpConfig.getServerIP(), n = count)
|
||||
@ -26,7 +25,7 @@ class MpExperienceVLC(MpExperience):
|
||||
|
||||
def pingCommand(self, fromIP, toIP, n=5):
|
||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||
" >> " + MpExperienceVLC.PING_OUTPUT
|
||||
" >> " + ExperienceVLC.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
@ -34,41 +33,41 @@ class MpExperienceVLC(MpExperience):
|
||||
"""
|
||||
todo : param LD_PRELOAD ??
|
||||
"""
|
||||
self.file = self.xpParam.getParam(MpParamXp.VLCFILE)
|
||||
self.time = self.xpParam.getParam(MpParamXp.VLCTIME)
|
||||
self.file = self.xpParam.getParam(ExperienceParameter.VLCFILE)
|
||||
self.time = self.xpParam.getParam(ExperienceParameter.VLCTIME)
|
||||
# todo
|
||||
# self.random_size = self.xpParam.getParam(MpParamXp.VLCRANDOMSIZE)
|
||||
# self.random_size = self.xpParam.getParam(ExperienceParameter.VLCRANDOMSIZE)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
Experience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceVLC.CLIENT_LOG )
|
||||
ExperienceVLC.CLIENT_LOG )
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "Xvfb :66 &")
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceVLC.SERVER_LOG )
|
||||
ExperienceVLC.SERVER_LOG )
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client,
|
||||
"dd if=/dev/urandom of=random bs=1K count=" + \
|
||||
self.random_size)
|
||||
|
||||
def getVLCServerCmd(self):
|
||||
s = "/etc/init.d/apache2 restart &>" + MpExperienceVLC.SERVER_LOG + " "
|
||||
s = "/etc/init.d/apache2 restart &>" + ExperienceVLC.SERVER_LOG + " "
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getVLCClientCmd(self):
|
||||
s = "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/mininet/usr/lib/ && sudo ldconfig && " \
|
||||
+ MpExperienceVLC.VLC_BIN + " -I dummy --x11-display :66" + \
|
||||
+ ExperienceVLC.VLC_BIN + " -I dummy --x11-display :66" + \
|
||||
" --adaptive-logic 3 --no-loop --play-and-exit " + \
|
||||
" http://" + self.mpConfig.getServerIP() + \
|
||||
"/" + self.file + " 2>&1 | grep -E '(Neb|halp|bandwidth|late|Buffering|buffering)' > " + MpExperienceVLC.CLIENT_LOG
|
||||
"/" + self.file + " 2>&1 | grep -E '(Neb|halp|bandwidth|late|Buffering|buffering)' > " + ExperienceVLC.CLIENT_LOG
|
||||
if self.time != "0" :
|
||||
s = s + " &"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
Experience.clean(self)
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "pkill Xvfb")
|
||||
|
@ -1,11 +1,9 @@
|
||||
from mpConfig import MpConfig
|
||||
from core.topo import Topo, TopoConfig, TopoParameter
|
||||
from mpMultiInterfaceTopo import MpMultiInterfaceTopo
|
||||
from mpParamTopo import MpParamTopo
|
||||
from mpTopo import MpTopo
|
||||
|
||||
class MpMultiInterfaceConfig(MpConfig):
|
||||
class MpMultiInterfaceConfig(TopoConfig):
|
||||
def __init__(self, topo, param):
|
||||
MpConfig.__init__(self, topo, param)
|
||||
super().__init__(topo, param)
|
||||
|
||||
def configureRoute(self):
|
||||
i = 0
|
||||
@ -33,9 +31,9 @@ class MpMultiInterfaceConfig(MpConfig):
|
||||
|
||||
def configureInterfaces(self):
|
||||
print("Configure interfaces for multi inf")
|
||||
self.client = self.topo.getHost(MpTopo.clientName)
|
||||
self.server = self.topo.getHost(MpTopo.serverName)
|
||||
self.router = self.topo.getHost(MpTopo.routerName)
|
||||
self.client = self.topo.getHost(Topo.clientName)
|
||||
self.server = self.topo.getHost(Topo.serverName)
|
||||
self.router = self.topo.getHost(Topo.routerName)
|
||||
i = 0
|
||||
netmask = "255.255.255.0"
|
||||
links = self.topo.getLinkCharacteristics()
|
||||
@ -78,27 +76,27 @@ class MpMultiInterfaceConfig(MpConfig):
|
||||
self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac)
|
||||
|
||||
def getClientIP(self, interfaceID):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
clientIP = lSubnet + str(interfaceID) + ".1"
|
||||
return clientIP
|
||||
|
||||
def getClientSubnet(self, interfaceID):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
clientSubnet = lSubnet + str(interfaceID) + ".0/24"
|
||||
return clientSubnet
|
||||
|
||||
def getRouterIPSwitch(self, interfaceID):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
routerIP = lSubnet + str(interfaceID) + ".2"
|
||||
return routerIP
|
||||
|
||||
def getRouterIPServer(self):
|
||||
rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
|
||||
rSubnet = self.param.getParam(TopoParameter.RSUBNET)
|
||||
routerIP = rSubnet + "0.2"
|
||||
return routerIP
|
||||
|
||||
def getServerIP(self):
|
||||
rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
|
||||
rSubnet = self.param.getParam(TopoParameter.RSUBNET)
|
||||
serverIP = rSubnet + "0.1"
|
||||
return serverIP
|
||||
|
||||
@ -109,19 +107,19 @@ class MpMultiInterfaceConfig(MpConfig):
|
||||
return self.getRouterInterfaceSwitch(len(self.topo.switchServer))
|
||||
|
||||
def getClientInterface(self, interfaceID):
|
||||
return MpTopo.clientName + "-eth" + str(interfaceID)
|
||||
return Topo.clientName + "-eth" + str(interfaceID)
|
||||
|
||||
def getRouterInterfaceSwitch(self, interfaceID):
|
||||
return MpTopo.routerName + "-eth" + str(interfaceID)
|
||||
return Topo.routerName + "-eth" + str(interfaceID)
|
||||
|
||||
def getServerInterface(self):
|
||||
return MpTopo.serverName + "-eth0"
|
||||
return Topo.serverName + "-eth0"
|
||||
|
||||
def getSwitchClientName(self, id):
|
||||
return MpTopo.switchNamePrefix + str(2 * id)
|
||||
return Topo.switchNamePrefix + str(2 * id)
|
||||
|
||||
def getSwitchServerName(self, id):
|
||||
return MpTopo.switchNamePrefix + str(2 * id + 1)
|
||||
return Topo.switchNamePrefix + str(2 * id + 1)
|
||||
|
||||
def getMidLeftName(self, id):
|
||||
return self.getSwitchClientName(id)
|
||||
|
@ -1,11 +1,9 @@
|
||||
from mpConfig import MpConfig
|
||||
from mpMultiInterfaceCongTopo import MpMultiInterfaceCongTopo
|
||||
from mpParamTopo import MpParamTopo
|
||||
from mpTopo import MpTopo
|
||||
from core.topo import TopoConfig, Topo, TopoParameter
|
||||
|
||||
class MpMultiInterfaceCongConfig(MpConfig):
|
||||
class MpMultiInterfaceCongConfig(TopoConfig):
|
||||
def __init__(self, topo, param):
|
||||
MpConfig.__init__(self, topo, param)
|
||||
super().__init__(topo, param)
|
||||
|
||||
def configureRoute(self):
|
||||
i = 0
|
||||
@ -65,9 +63,9 @@ class MpMultiInterfaceCongConfig(MpConfig):
|
||||
|
||||
def configureInterfaces(self):
|
||||
print("Configure interfaces for multi inf")
|
||||
self.client = self.topo.getHost(MpTopo.clientName)
|
||||
self.server = self.topo.getHost(MpTopo.serverName)
|
||||
self.router = self.topo.getHost(MpTopo.routerName)
|
||||
self.client = self.topo.getHost(Topo.clientName)
|
||||
self.server = self.topo.getHost(Topo.serverName)
|
||||
self.router = self.topo.getHost(Topo.routerName)
|
||||
cong_client_names = self.topo.getCongClients()
|
||||
self.cong_clients = []
|
||||
for cn in cong_client_names:
|
||||
@ -142,42 +140,42 @@ class MpMultiInterfaceCongConfig(MpConfig):
|
||||
i = i + 1
|
||||
|
||||
def getClientIP(self, interfaceID):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
clientIP = lSubnet + str(interfaceID) + ".1"
|
||||
return clientIP
|
||||
|
||||
def getCongClientIP(self, interfaceID):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
congClientIP = lSubnet + str(interfaceID) + ".127"
|
||||
return congClientIP
|
||||
|
||||
def getClientSubnet(self, interfaceID):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
clientSubnet = lSubnet + str(interfaceID) + ".0/24"
|
||||
return clientSubnet
|
||||
|
||||
def getRouterIPSwitch(self, interfaceID):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
routerIP = lSubnet + str(interfaceID) + ".2"
|
||||
return routerIP
|
||||
|
||||
def getRouterIPServer(self):
|
||||
rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
|
||||
rSubnet = self.param.getParam(TopoParameter.RSUBNET)
|
||||
routerIP = rSubnet + "0.2"
|
||||
return routerIP
|
||||
|
||||
def getRouterIPCongServer(self, congID):
|
||||
rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
|
||||
rSubnet = self.param.getParam(TopoParameter.RSUBNET)
|
||||
routerIP = rSubnet + str(1 + congID) + ".2"
|
||||
return routerIP
|
||||
|
||||
def getServerIP(self):
|
||||
rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
|
||||
rSubnet = self.param.getParam(TopoParameter.RSUBNET)
|
||||
serverIP = rSubnet + "0.1"
|
||||
return serverIP
|
||||
|
||||
def getCongServerIP(self, congID):
|
||||
rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
|
||||
rSubnet = self.param.getParam(TopoParameter.RSUBNET)
|
||||
serverIP = rSubnet + str(1 + congID) + ".1"
|
||||
return serverIP
|
||||
|
||||
@ -191,25 +189,25 @@ class MpMultiInterfaceCongConfig(MpConfig):
|
||||
return self.getRouterInterfaceSwitch(len(self.topo.switch) + 1 + congID)
|
||||
|
||||
def getClientInterface(self, interfaceID):
|
||||
return MpTopo.clientName + "-eth" + str(interfaceID)
|
||||
return Topo.clientName + "-eth" + str(interfaceID)
|
||||
|
||||
def getCongClientInterface(self, interfaceID):
|
||||
return MpMultiInterfaceCongTopo.congClientName + str(interfaceID) + "-eth0"
|
||||
|
||||
def getRouterInterfaceSwitch(self, interfaceID):
|
||||
return MpTopo.routerName + "-eth" + str(interfaceID)
|
||||
return Topo.routerName + "-eth" + str(interfaceID)
|
||||
|
||||
def getServerInterface(self):
|
||||
return MpTopo.serverName + "-eth0"
|
||||
return Topo.serverName + "-eth0"
|
||||
|
||||
def getCongServerInterface(self, interfaceID):
|
||||
return MpMultiInterfaceCongTopo.congServerName + str(interfaceID) + "-eth0"
|
||||
|
||||
def getMidLeftName(self, id):
|
||||
return MpTopo.switchNamePrefix + str(id)
|
||||
return Topo.switchNamePrefix + str(id)
|
||||
|
||||
def getMidRightName(self, id):
|
||||
return MpTopo.routerName
|
||||
return Topo.routerName
|
||||
|
||||
def getMidL2RInterface(self, id):
|
||||
return self.getMidLeftName(id) + "-eth2"
|
||||
|
@ -1,15 +1,15 @@
|
||||
from mpTopo import MpTopo
|
||||
from core.topo import Topo
|
||||
|
||||
class MpMultiInterfaceCongTopo(MpTopo):
|
||||
class MpMultiInterfaceCongTopo(Topo):
|
||||
congClientName = "CCli"
|
||||
congServerName = "CSer"
|
||||
|
||||
def __init__(self, topoBuilder, parameterFile):
|
||||
MpTopo.__init__(self,topoBuilder, parameterFile)
|
||||
super().__init__(topoBuilder, parameterFile)
|
||||
print("Hello from topo multi if")
|
||||
self.client = self.addHost(MpTopo.clientName)
|
||||
self.server = self.addHost(MpTopo.serverName)
|
||||
self.router = self.addHost(MpTopo.routerName)
|
||||
self.client = self.addHost(Topo.clientName)
|
||||
self.server = self.addHost(Topo.serverName)
|
||||
self.router = self.addHost(Topo.routerName)
|
||||
self.cong_clients = []
|
||||
self.cong_servers = []
|
||||
self.switch = []
|
||||
|
@ -1,12 +1,12 @@
|
||||
from mpTopo import MpTopo
|
||||
from core.topo import Topo
|
||||
|
||||
class MpMultiInterfaceTopo(MpTopo):
|
||||
class MpMultiInterfaceTopo(Topo):
|
||||
def __init__(self, topoBuilder, parameterFile):
|
||||
MpTopo.__init__(self,topoBuilder, parameterFile)
|
||||
super().__init__(topoBuilder, parameterFile)
|
||||
print("Hello from topo multi if")
|
||||
self.client = self.addHost(MpTopo.clientName)
|
||||
self.server = self.addHost(MpTopo.serverName)
|
||||
self.router = self.addHost(MpTopo.routerName)
|
||||
self.client = self.addHost(Topo.clientName)
|
||||
self.server = self.addHost(Topo.serverName)
|
||||
self.router = self.addHost(Topo.routerName)
|
||||
self.switchClient = []
|
||||
self.switchServer = []
|
||||
for l in self.topoParam.linkCharacteristics:
|
||||
|
42
mpParam.py
42
mpParam.py
@ -1,42 +0,0 @@
|
||||
|
||||
class MpParam:
|
||||
def __init__(self, paramFile):
|
||||
self.paramDic = {}
|
||||
print("Create the param Object")
|
||||
if paramFile is None:
|
||||
print("default param...")
|
||||
else:
|
||||
self.loadParamFile(paramFile)
|
||||
|
||||
def loadParamFile(self, paramFile):
|
||||
f = open(paramFile)
|
||||
i = 0
|
||||
for l in f:
|
||||
i = i + 1
|
||||
if l.startswith("#"):
|
||||
continue
|
||||
|
||||
tab = l.split(":")
|
||||
if len(tab) == 2:
|
||||
k = tab[0]
|
||||
val = tab[1].rstrip()
|
||||
if k in self.paramDic:
|
||||
if not isinstance(self.paramDic[k], list):
|
||||
self.paramDic[k] = [self.paramDic[k]]
|
||||
self.paramDic[k].append(val)
|
||||
else:
|
||||
self.paramDic[k] = val
|
||||
else:
|
||||
print("Ignored Line " + str(i))
|
||||
print(l),
|
||||
print("In file " + paramFile)
|
||||
f.close()
|
||||
|
||||
def getParam(self, key):
|
||||
if key in self.paramDic:
|
||||
return self.paramDic[key]
|
||||
return None
|
||||
|
||||
def __str__(self):
|
||||
s = self.paramDic.__str__()
|
||||
return s
|
@ -1,89 +0,0 @@
|
||||
from mpLinkCharacteristics import MpLinkCharacteristics
|
||||
from mpParam import MpParam
|
||||
from mpNetemAt import MpNetemAt
|
||||
|
||||
class MpParamTopo(MpParam):
|
||||
LSUBNET = "leftSubnet"
|
||||
RSUBNET = "rightSubnet"
|
||||
netemAt = "netemAt_"
|
||||
changeNetem = "changeNetem"
|
||||
defaultValue = {}
|
||||
defaultValue[LSUBNET] = "10.1."
|
||||
defaultValue[RSUBNET] = "10.2."
|
||||
defaultValue[changeNetem] = "false"
|
||||
|
||||
def __init__(self, paramFile):
|
||||
MpParam.__init__(self, paramFile)
|
||||
self.linkCharacteristics = []
|
||||
self.loadLinkCharacteristics()
|
||||
self.loadNetemAt()
|
||||
print(self.__str__())
|
||||
|
||||
def loadNetemAt(self):
|
||||
if not self.getParam(MpParamTopo.changeNetem) == "yes":
|
||||
return
|
||||
for k in sorted(self.paramDic):
|
||||
if k.startswith(MpParamTopo.netemAt):
|
||||
i = int(k[len(MpParamTopo.netemAt):])
|
||||
val = self.paramDic[k]
|
||||
if not isinstance(val, list):
|
||||
tmp = val
|
||||
val = []
|
||||
val.append(tmp)
|
||||
self.loadNetemAtList(i, val)
|
||||
|
||||
def loadNetemAtList(self, id, nlist):
|
||||
for n in nlist:
|
||||
tab = n.split(",")
|
||||
if len(tab)==2:
|
||||
o = MpNetemAt(float(tab[0]), tab[1])
|
||||
if id < len(self.linkCharacteristics):
|
||||
self.linkCharacteristics[id].addNetemAt(o)
|
||||
else:
|
||||
print("Error can't set netem for link " + str(id))
|
||||
else:
|
||||
print("Netem wrong line : " + n)
|
||||
print(self.linkCharacteristics[id].netemAt)
|
||||
|
||||
def loadLinkCharacteristics(self):
|
||||
i = 0
|
||||
for k in sorted(self.paramDic):
|
||||
if k.startswith("path"):
|
||||
tab = self.paramDic[k].split(",")
|
||||
bup = False
|
||||
loss = "0.0"
|
||||
if len(tab) == 5:
|
||||
loss = tab[3]
|
||||
bup = tab[4] == 'True'
|
||||
if len(tab) == 4:
|
||||
try:
|
||||
loss = float(tab[3])
|
||||
loss = tab[3]
|
||||
except ValueError:
|
||||
bup = tab[3] == 'True'
|
||||
if len(tab) == 3 or len(tab) == 4 or len(tab) == 5:
|
||||
path = MpLinkCharacteristics(i,tab[0],
|
||||
tab[1], tab[2], loss, bup)
|
||||
self.linkCharacteristics.append(path)
|
||||
i = i + 1
|
||||
else:
|
||||
print("Ignored path :")
|
||||
print(self.paramDic[k])
|
||||
|
||||
def getParam(self, key):
|
||||
val = MpParam.getParam(self, key)
|
||||
if val is None:
|
||||
if key in MpParamTopo.defaultValue:
|
||||
return MpParamTopo.defaultValue[key]
|
||||
else:
|
||||
raise Exception("Param not found " + key)
|
||||
else:
|
||||
return val
|
||||
|
||||
def __str__(self):
|
||||
s = MpParam.__str__(self)
|
||||
s = s + "\n"
|
||||
for p in self.linkCharacteristics[:-1]:
|
||||
s = s + p.__str__() + "\n"
|
||||
s = s + self.linkCharacteristics[-1].__str__()
|
||||
return s
|
@ -2,7 +2,7 @@
|
||||
|
||||
import sys, getopt
|
||||
from mpXpRunner import MpXpRunner
|
||||
from mpTopo import MpTopo
|
||||
from core.topo import Topo
|
||||
|
||||
topoParamFile = None
|
||||
xpParamFile = None
|
||||
@ -35,4 +35,4 @@ def parseArgs(argv):
|
||||
|
||||
if __name__ == '__main__':
|
||||
parseArgs(sys.argv[1:])
|
||||
MpXpRunner(MpTopo.mininetBuilder, topoParamFile, xpParamFile)
|
||||
MpXpRunner(Topo.mininetBuilder, topoParamFile, xpParamFile)
|
||||
|
60
mpTopo.py
60
mpTopo.py
@ -1,60 +0,0 @@
|
||||
from mpParamTopo import MpParamTopo
|
||||
|
||||
class MpTopo:
|
||||
mininetBuilder = "mininet"
|
||||
multiIfTopo = "MultiIf"
|
||||
ECMPLikeTopo = "ECMPLike"
|
||||
twoIfCongTopo = "twoIfCong"
|
||||
multiIfCongTopo = "MultiIfCong"
|
||||
topoAttr = "topoType"
|
||||
switchNamePrefix = "s"
|
||||
routerNamePrefix = "r"
|
||||
clientName = "Client"
|
||||
serverName = "Server"
|
||||
routerName = "Router"
|
||||
cmdLog = "command.log"
|
||||
|
||||
"""Simple MpTopo"""
|
||||
def __init__(self, topoBuilder, topoParam):
|
||||
self.topoBuilder = topoBuilder
|
||||
self.topoParam = topoParam
|
||||
self.changeNetem = topoParam.getParam(MpParamTopo.changeNetem)
|
||||
self.logFile = open(MpTopo.cmdLog, 'w')
|
||||
|
||||
def getLinkCharacteristics(self):
|
||||
return self.topoParam.linkCharacteristics
|
||||
|
||||
def commandTo(self, who, cmd):
|
||||
self.logFile.write(who.__str__() + " : " + cmd + "\n")
|
||||
return self.topoBuilder.commandTo(who, cmd)
|
||||
|
||||
def notNSCommand(self, cmd):
|
||||
"""
|
||||
mainly use for not namespace sysctl.
|
||||
"""
|
||||
self.logFile.write("Not_NS" + " : " + cmd + "\n")
|
||||
return self.topoBuilder.notNSCommand(cmd)
|
||||
|
||||
def getHost(self, who):
|
||||
return self.topoBuilder.getHost(who)
|
||||
|
||||
def addHost(self, host):
|
||||
return self.topoBuilder.addHost(host)
|
||||
|
||||
def addSwitch(self, switch):
|
||||
return self.topoBuilder.addSwitch(switch)
|
||||
|
||||
def addLink(self, fromA, toB, **kwargs):
|
||||
self.topoBuilder.addLink(fromA,toB,**kwargs)
|
||||
|
||||
def getCLI(self):
|
||||
self.topoBuilder.getCLI()
|
||||
|
||||
def startNetwork(self):
|
||||
self.topoBuilder.startNetwork()
|
||||
|
||||
def closeLogFile(self):
|
||||
self.logFile.close()
|
||||
|
||||
def stopNetwork(self):
|
||||
self.topoBuilder.stopNetwork()
|
@ -1,18 +1,15 @@
|
||||
from mpConfig import MpConfig
|
||||
from core.topo import Topo, TopoConfig, TopoParameter
|
||||
from mpTwoInterfaceCongestionTopo import MpTwoInterfaceCongestionTopo
|
||||
from mpParamTopo import MpParamTopo
|
||||
from mpTopo import MpTopo
|
||||
|
||||
|
||||
class MpTwoInterfaceCongestionConfig(MpConfig):
|
||||
class MpTwoInterfaceCongestionConfig(TopoConfig):
|
||||
def __init__(self, topo, param):
|
||||
MpConfig.__init__(self, topo, param)
|
||||
super().__init__(topo, param)
|
||||
|
||||
def configureRoute(self):
|
||||
# Client - Router
|
||||
cmd = self.addRouteTableCommand("10.0.0.1", 0)
|
||||
self.topo.commandTo(self.client, cmd)
|
||||
cmd = self.addRouteScopeLinkCommand("10.0.0.0/24", MpTopo.clientName + "-eth0", 0)
|
||||
cmd = self.addRouteScopeLinkCommand("10.0.0.0/24", Topo.clientName + "-eth0", 0)
|
||||
self.topo.commandTo(self.client, cmd)
|
||||
cmd = self.addRouteDefaultCommand("10.0.0.2", 0)
|
||||
self.topo.commandTo(self.client, cmd)
|
||||
@ -20,7 +17,7 @@ class MpTwoInterfaceCongestionConfig(MpConfig):
|
||||
# Client -> Router cong
|
||||
cmd = self.addRouteTableCommand("10.0.1.1", 1)
|
||||
self.topo.commandTo(self.client, cmd)
|
||||
cmd = self.addRouteScopeLinkCommand("10.0.1.0/24", MpTopo.clientName + "-eth1", 1)
|
||||
cmd = self.addRouteScopeLinkCommand("10.0.1.0/24", Topo.clientName + "-eth1", 1)
|
||||
self.topo.commandTo(self.client, cmd)
|
||||
cmd = self.addRouteDefaultCommand("10.0.1.2", 1)
|
||||
self.topo.commandTo(self.client, cmd)
|
||||
@ -28,7 +25,7 @@ class MpTwoInterfaceCongestionConfig(MpConfig):
|
||||
# Client cong -> Router cong
|
||||
cmd = self.addRouteTableCommand("10.0.2.1", 0)
|
||||
self.topo.commandTo(self.clientCong, cmd)
|
||||
cmd = self.addRouteScopeLinkCommand("10.0.2.0/24", MpTopo.clientName + "Cong-eth0", 0)
|
||||
cmd = self.addRouteScopeLinkCommand("10.0.2.0/24", Topo.clientName + "Cong-eth0", 0)
|
||||
self.topo.commandTo(self.clientCong, cmd)
|
||||
cmd = self.addRouteDefaultCommand("10.0.2.2", 0)
|
||||
self.topo.commandTo(self.clientCong, cmd)
|
||||
@ -36,7 +33,7 @@ class MpTwoInterfaceCongestionConfig(MpConfig):
|
||||
# Router cong -> Router
|
||||
cmd = self.addRouteTableCommand("10.0.3.1", 0)
|
||||
self.topo.commandTo(self.routerCong, cmd)
|
||||
cmd = self.addRouteScopeLinkCommand("10.1.0.0/16", MpTopo.routerName + "Cong-eth2", 0)
|
||||
cmd = self.addRouteScopeLinkCommand("10.1.0.0/16", Topo.routerName + "Cong-eth2", 0)
|
||||
self.topo.commandTo(self.routerCong, cmd)
|
||||
cmd = self.addRouteDefaultCommand("10.0.3.2", 0)
|
||||
self.topo.commandTo(self.routerCong, cmd)
|
||||
@ -44,33 +41,33 @@ class MpTwoInterfaceCongestionConfig(MpConfig):
|
||||
# Router -> Router cong
|
||||
cmd = self.addRouteTableCommand("10.0.3.2", 0)
|
||||
self.topo.commandTo(self.router, cmd)
|
||||
cmd = self.addRouteScopeLinkCommand("10.0.0.0/16", MpTopo.routerName + "-eth1", 0)
|
||||
cmd = self.addRouteScopeLinkCommand("10.0.0.0/16", Topo.routerName + "-eth1", 0)
|
||||
self.topo.commandTo(self.router, cmd)
|
||||
cmd = self.addRouteDefaultCommand("10.0.3.1", 0)
|
||||
self.topo.commandTo(self.router, cmd)
|
||||
|
||||
# Default route Client
|
||||
cmd = self.addRouteDefaultGlobalCommand("10.0.0.2", MpTopo.clientName + "-eth0")
|
||||
cmd = self.addRouteDefaultGlobalCommand("10.0.0.2", Topo.clientName + "-eth0")
|
||||
self.topo.commandTo(self.client, cmd)
|
||||
|
||||
# Default route Client cong
|
||||
cmd = self.addRouteDefaultGlobalCommand("10.0.2.2", MpTopo.clientName + "Cong-eth0")
|
||||
cmd = self.addRouteDefaultGlobalCommand("10.0.2.2", Topo.clientName + "Cong-eth0")
|
||||
self.topo.commandTo(self.clientCong, cmd)
|
||||
|
||||
# Default route Router cong
|
||||
cmd = self.addRouteDefaultGlobalCommand("10.0.3.2", MpTopo.routerName + "Cong-eth2")
|
||||
cmd = self.addRouteDefaultGlobalCommand("10.0.3.2", Topo.routerName + "Cong-eth2")
|
||||
self.topo.commandTo(self.routerCong, cmd)
|
||||
|
||||
# Default route Router
|
||||
cmd = self.addRouteDefaultGlobalCommand("10.0.3.1", MpTopo.routerName + "-eth1")
|
||||
cmd = self.addRouteDefaultGlobalCommand("10.0.3.1", Topo.routerName + "-eth1")
|
||||
self.topo.commandTo(self.router, cmd)
|
||||
|
||||
# Default route Server
|
||||
cmd = self.addRouteDefaultGlobalCommand("10.1.0.2", MpTopo.serverName + "-eth0")
|
||||
cmd = self.addRouteDefaultGlobalCommand("10.1.0.2", Topo.serverName + "-eth0")
|
||||
self.topo.commandTo(self.server, cmd)
|
||||
|
||||
# Default route Server cong
|
||||
cmd = self.addRouteDefaultGlobalCommand("10.1.1.2", MpTopo.serverName + "Cong-eth0")
|
||||
cmd = self.addRouteDefaultGlobalCommand("10.1.1.2", Topo.serverName + "Cong-eth0")
|
||||
self.topo.commandTo(self.serverCong, cmd)
|
||||
|
||||
def configureInterface(self, srcHost, dstHost, srcInterfaceName, srcIP, netmask):
|
||||
@ -82,84 +79,84 @@ class MpTwoInterfaceCongestionConfig(MpConfig):
|
||||
|
||||
def configureInterfaces(self):
|
||||
print("Configure interfaces for two inf cong")
|
||||
self.client = self.topo.getHost(MpTopo.clientName)
|
||||
self.clientCong = self.topo.getHost(MpTopo.clientName + "Cong")
|
||||
self.server = self.topo.getHost(MpTopo.serverName)
|
||||
self.serverCong = self.topo.getHost(MpTopo.serverName + "Cong")
|
||||
self.router = self.topo.getHost(MpTopo.routerName)
|
||||
self.routerCong = self.topo.getHost(MpTopo.routerName + "Cong")
|
||||
self.client = self.topo.getHost(Topo.clientName)
|
||||
self.clientCong = self.topo.getHost(Topo.clientName + "Cong")
|
||||
self.server = self.topo.getHost(Topo.serverName)
|
||||
self.serverCong = self.topo.getHost(Topo.serverName + "Cong")
|
||||
self.router = self.topo.getHost(Topo.routerName)
|
||||
self.routerCong = self.topo.getHost(Topo.routerName + "Cong")
|
||||
netmask = "255.255.255.0"
|
||||
links = self.topo.getLinkCharacteristics()
|
||||
|
||||
# Link 0: Client - Router
|
||||
self.configureInterface(self.client, self.router, MpTopo.clientName + "-eth0", "10.0.0.1", netmask)
|
||||
self.configureInterface(self.client, self.router, Topo.clientName + "-eth0", "10.0.0.1", netmask)
|
||||
|
||||
if(links[0].back_up):
|
||||
cmd = self.interfaceBUPCommand(MpTopo.clientName + "-eth0")
|
||||
cmd = self.interfaceBUPCommand(Topo.clientName + "-eth0")
|
||||
self.topo.commandTo(self.client, cmd)
|
||||
|
||||
self.configureInterface(self.router, self.client, MpTopo.routerName + "-eth0", "10.0.0.2", netmask)
|
||||
self.configureInterface(self.router, self.client, Topo.routerName + "-eth0", "10.0.0.2", netmask)
|
||||
print(str(links[0]))
|
||||
|
||||
# Client - Router cong
|
||||
self.configureInterface(self.client, self.routerCong, MpTopo.clientName + "-eth1", "10.0.1.1", netmask)
|
||||
self.configureInterface(self.client, self.routerCong, Topo.clientName + "-eth1", "10.0.1.1", netmask)
|
||||
|
||||
if(links[1].back_up):
|
||||
cmd = self.interfaceBUPCommand(MpTopo.clientName + "-eth1")
|
||||
cmd = self.interfaceBUPCommand(Topo.clientName + "-eth1")
|
||||
self.topo.commandTo(self.client, cmd)
|
||||
|
||||
self.configureInterface(self.routerCong, self.client, MpTopo.routerName + "Cong-eth0", "10.0.1.2", netmask)
|
||||
self.configureInterface(self.routerCong, self.client, Topo.routerName + "Cong-eth0", "10.0.1.2", netmask)
|
||||
|
||||
# Link 1: Router - Router cong
|
||||
self.configureInterface(self.routerCong, self.router, MpTopo.routerName + "Cong-eth2", "10.0.3.1", netmask)
|
||||
self.configureInterface(self.router, self.routerCong, MpTopo.routerName + "-eth1", "10.0.3.2", netmask)
|
||||
self.configureInterface(self.routerCong, self.router, Topo.routerName + "Cong-eth2", "10.0.3.1", netmask)
|
||||
self.configureInterface(self.router, self.routerCong, Topo.routerName + "-eth1", "10.0.3.2", netmask)
|
||||
print(str(links[1]))
|
||||
|
||||
# Link 2: Client cong - Router cong
|
||||
self.configureInterface(self.clientCong, self.routerCong, MpTopo.clientName + "Cong-eth0", "10.0.2.1", netmask)
|
||||
self.configureInterface(self.routerCong, self.clientCong, MpTopo.routerName + "Cong-eth1", "10.0.2.2", netmask)
|
||||
self.configureInterface(self.clientCong, self.routerCong, Topo.clientName + "Cong-eth0", "10.0.2.1", netmask)
|
||||
self.configureInterface(self.routerCong, self.clientCong, Topo.routerName + "Cong-eth1", "10.0.2.2", netmask)
|
||||
print(str(links[2]))
|
||||
|
||||
# Router - Server
|
||||
self.configureInterface(self.server, self.router, MpTopo.serverName + "-eth0", "10.1.0.1", netmask)
|
||||
self.configureInterface(self.router, self.server, MpTopo.routerName + "-eth2", "10.1.0.2", netmask)
|
||||
self.configureInterface(self.server, self.router, Topo.serverName + "-eth0", "10.1.0.1", netmask)
|
||||
self.configureInterface(self.router, self.server, Topo.routerName + "-eth2", "10.1.0.2", netmask)
|
||||
|
||||
# Router - Server cong
|
||||
self.configureInterface(self.serverCong, self.router, MpTopo.serverName + "Cong-eth0", "10.1.1.1", netmask)
|
||||
self.configureInterface(self.router, self.serverCong, MpTopo.routerName + "-eth3", "10.1.1.2", netmask)
|
||||
self.configureInterface(self.serverCong, self.router, Topo.serverName + "Cong-eth0", "10.1.1.1", netmask)
|
||||
self.configureInterface(self.router, self.serverCong, Topo.routerName + "-eth3", "10.1.1.2", netmask)
|
||||
|
||||
def getClientIP(self, interfaceID):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
clientIP = lSubnet + str(interfaceID) + ".1"
|
||||
return clientIP
|
||||
|
||||
def getClientSubnet(self, interfaceID):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
clientSubnet = lSubnet + str(interfaceID) + ".0/24"
|
||||
return clientSubnet
|
||||
|
||||
def getClientCongIP(self):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
clientIP = lSubnet + str(2) + ".1"
|
||||
return clientIP
|
||||
|
||||
def getClientCongSubnet(self, interfaceID):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
clientSubnet = lSubnet + str(128) + ".0/24"
|
||||
return clientSubnet
|
||||
|
||||
def getRouterIPSwitch(self, interfaceID):
|
||||
lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
|
||||
lSubnet = self.param.getParam(TopoParameter.LSUBNET)
|
||||
routerIP = lSubnet + str(interfaceID) + ".2"
|
||||
return routerIP
|
||||
|
||||
def getRouterIPServer(self):
|
||||
rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
|
||||
rSubnet = self.param.getParam(TopoParameter.RSUBNET)
|
||||
routerIP = rSubnet + "0.2"
|
||||
return routerIP
|
||||
|
||||
def getServerIP(self):
|
||||
rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
|
||||
rSubnet = self.param.getParam(TopoParameter.RSUBNET)
|
||||
serverIP = rSubnet + "0.1"
|
||||
return serverIP
|
||||
|
||||
@ -170,22 +167,22 @@ class MpTwoInterfaceCongestionConfig(MpConfig):
|
||||
return self.getRouterInterfaceSwitch(len(self.topo.switch))
|
||||
|
||||
def getClientInterface(self, interfaceID):
|
||||
return MpTopo.clientName + "-eth" + str(interfaceID)
|
||||
return Topo.clientName + "-eth" + str(interfaceID)
|
||||
|
||||
def getRouterInterfaceSwitch(self, interfaceID):
|
||||
return MpTopo.routerName + "-eth" + str(interfaceID)
|
||||
return Topo.routerName + "-eth" + str(interfaceID)
|
||||
|
||||
def getServerInterface(self):
|
||||
return MpTopo.serverName + "-eth0"
|
||||
return Topo.serverName + "-eth0"
|
||||
|
||||
def getMidLeftName(self, id):
|
||||
return MpTopo.switchNamePrefix + str(id)
|
||||
return Topo.switchNamePrefix + str(id)
|
||||
|
||||
def getMidRightName(self, id):
|
||||
if id == 2:
|
||||
return MpTopo.routerName + "Cong"
|
||||
return Topo.routerName + "Cong"
|
||||
|
||||
return MpTopo.routerName
|
||||
return Topo.routerName
|
||||
|
||||
def getMidL2RInterface(self, id):
|
||||
return self.getMidLeftName(id) + "-eth2"
|
||||
|
@ -1,9 +1,8 @@
|
||||
from mpTopo import MpTopo
|
||||
from core.topo import Topo
|
||||
|
||||
|
||||
class MpTwoInterfaceCongestionTopo(MpTopo):
|
||||
class MpTwoInterfaceCongestionTopo(Topo):
|
||||
def __init__(self, topoBuilder, parameterFile):
|
||||
MpTopo.__init__(self, topoBuilder, parameterFile)
|
||||
super().__init__(topoBuilder, parameterFile)
|
||||
|
||||
print("Hello from topo two ifs cong")
|
||||
print("Expected topo:")
|
||||
@ -12,12 +11,12 @@ class MpTwoInterfaceCongestionTopo(MpTopo):
|
||||
print(" | |------s2")
|
||||
print("c2----link2----")
|
||||
|
||||
self.client = self.addHost(MpTopo.clientName)
|
||||
self.clientCong = self.addHost(MpTopo.clientName + "Cong")
|
||||
self.server = self.addHost(MpTopo.serverName)
|
||||
self.serverCong = self.addHost(MpTopo.serverName + "Cong")
|
||||
self.router = self.addHost(MpTopo.routerName)
|
||||
self.routerCong = self.addHost(MpTopo.routerName + "Cong")
|
||||
self.client = self.addHost(Topo.clientName)
|
||||
self.clientCong = self.addHost(Topo.clientName + "Cong")
|
||||
self.server = self.addHost(Topo.serverName)
|
||||
self.serverCong = self.addHost(Topo.serverName + "Cong")
|
||||
self.router = self.addHost(Topo.routerName)
|
||||
self.routerCong = self.addHost(Topo.routerName + "Cong")
|
||||
self.switch = []
|
||||
|
||||
# Link between c1 and r2
|
||||
@ -53,4 +52,4 @@ class MpTwoInterfaceCongestionTopo(MpTopo):
|
||||
return s
|
||||
|
||||
def addOneSwitchPerLink(self, link):
|
||||
return self.addSwitch(MpTopo.switchNamePrefix + str(link.id))
|
||||
return self.addSwitch(Topo.switchNamePrefix + str(link.id))
|
||||
|
203
mpXpRunner.py
203
mpXpRunner.py
@ -1,6 +1,6 @@
|
||||
from mpTopo import MpTopo
|
||||
from mpParamTopo import MpParamTopo
|
||||
from mpParamXp import MpParamXp
|
||||
from core.experience import Experience, ExperienceParameter, ExperienceParameter
|
||||
from core.topo import Topo, TopoParameter
|
||||
|
||||
from mpMultiInterfaceTopo import MpMultiInterfaceTopo
|
||||
from mpMultiInterfaceConfig import MpMultiInterfaceConfig
|
||||
from mpMultiInterfaceCongConfig import MpMultiInterfaceCongConfig
|
||||
@ -8,33 +8,32 @@ from mpMultiInterfaceCongTopo import MpMultiInterfaceCongTopo
|
||||
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
|
||||
from mpExperienceHTTP import MpExperienceHTTP
|
||||
from mpExperienceSendFile import MpExperienceSendFile
|
||||
from mpExperienceEpload import MpExperienceEpload
|
||||
from mpExperienceNetperf import MpExperienceNetperf
|
||||
from mpExperienceAb import MpExperienceAb
|
||||
from mpExperienceSiri import MpExperienceSiri
|
||||
from mpExperienceVLC import MpExperienceVLC
|
||||
from mpExperienceIperf import MpExperienceIperf
|
||||
from mpExperienceDITG import MpExperienceDITG
|
||||
from mpExperienceMsg import MpExperienceMsg
|
||||
from mpExperienceSiriHTTP import MpExperienceSiriHTTP
|
||||
from mpExperienceSiriMsg import MpExperienceSiriMsg
|
||||
from mpExperienceQUIC import MpExperienceQUIC
|
||||
from mpExperienceQUICSiri import MpExperienceQUICSiri
|
||||
from mpExperienceNone import MpExperienceNone
|
||||
from mpExperience import MpExperience
|
||||
from mpExperiencePing import ExperiencePing
|
||||
from mpExperienceNCPV import ExperienceNCPV
|
||||
from mpExperienceNC import ExperienceNC
|
||||
from mpExperienceHTTPS import ExperienceHTTPS
|
||||
from mpExperienceHTTP import ExperienceHTTP
|
||||
from mpExperienceSendFile import ExperienceSendFile
|
||||
from mpExperienceEpload import ExperienceEpload
|
||||
from mpExperienceNetperf import ExperienceNetperf
|
||||
from mpExperienceAb import ExperienceAb
|
||||
from mpExperienceSiri import ExperienceSiri
|
||||
from mpExperienceVLC import ExperienceVLC
|
||||
from mpExperienceIperf import ExperienceIperf
|
||||
from mpExperienceDITG import ExperienceDITG
|
||||
from mpExperienceMsg import ExperienceMsg
|
||||
from mpExperienceSiriHTTP import ExperienceSiriHTTP
|
||||
from mpExperienceSiriMsg import ExperienceSiriMsg
|
||||
from mpExperienceQUIC import ExperienceQUIC
|
||||
from mpExperienceQUICSiri import ExperienceQUICSiri
|
||||
from mpExperienceNone import ExperienceNone
|
||||
from mpECMPSingleInterfaceTopo import MpECMPSingleInterfaceTopo
|
||||
from mpTwoInterfaceCongestionTopo import MpTwoInterfaceCongestionTopo
|
||||
|
||||
class MpXpRunner:
|
||||
def __init__(self, builderType, topoParamFile, xpParamFile):
|
||||
self.defParamXp(xpParamFile)
|
||||
self.topoParam = MpParamTopo(topoParamFile)
|
||||
self.topoParam = TopoParameter(topoParamFile)
|
||||
self.defBuilder(builderType)
|
||||
self.defTopo()
|
||||
self.defConfig()
|
||||
@ -43,110 +42,110 @@ class MpXpRunner:
|
||||
self.stopTopo()
|
||||
|
||||
def defParamXp(self, xpParamFile):
|
||||
self.xpParam = MpParamXp(xpParamFile)
|
||||
self.xpParam = ExperienceParameter(xpParamFile)
|
||||
|
||||
def defBuilder(self, builderType):
|
||||
if builderType == MpTopo.mininetBuilder:
|
||||
if builderType == Topo.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,
|
||||
t = self.topoParam.getParam(Topo.topoAttr)
|
||||
if t == Topo.multiIfTopo:
|
||||
self.Topo = MpMultiInterfaceTopo(self.topoBuilder,
|
||||
self.topoParam)
|
||||
elif t == MpTopo.ECMPLikeTopo:
|
||||
self.mpTopo = MpECMPSingleInterfaceTopo(
|
||||
elif t == Topo.ECMPLikeTopo:
|
||||
self.Topo = MpECMPSingleInterfaceTopo(
|
||||
self.topoBuilder,
|
||||
self.topoParam)
|
||||
elif t == MpTopo.twoIfCongTopo:
|
||||
self.mpTopo = MpTwoInterfaceCongestionTopo(
|
||||
elif t == Topo.twoIfCongTopo:
|
||||
self.Topo = MpTwoInterfaceCongestionTopo(
|
||||
self.topoBuilder, self.topoParam)
|
||||
elif t == MpTopo.multiIfCongTopo:
|
||||
self.mpTopo = MpMultiInterfaceCongTopo(self.topoBuilder,
|
||||
elif t == Topo.multiIfCongTopo:
|
||||
self.Topo = MpMultiInterfaceCongTopo(self.topoBuilder,
|
||||
self.topoParam)
|
||||
else:
|
||||
raise Exception("Unfound Topo" + t)
|
||||
print(self.mpTopo)
|
||||
print(self.Topo)
|
||||
|
||||
def defConfig(self):
|
||||
t = self.topoParam.getParam(MpTopo.topoAttr)
|
||||
if t == MpTopo.multiIfTopo:
|
||||
self.mpTopoConfig = MpMultiInterfaceConfig(self.mpTopo,
|
||||
t = self.topoParam.getParam(Topo.topoAttr)
|
||||
if t == Topo.multiIfTopo:
|
||||
self.TopoConfig = MpMultiInterfaceConfig(self.Topo,
|
||||
self.topoParam)
|
||||
elif t == MpTopo.ECMPLikeTopo:
|
||||
self.mpTopoConfig = MpECMPSingleInterfaceConfig(
|
||||
self.mpTopo,
|
||||
elif t == Topo.ECMPLikeTopo:
|
||||
self.TopoConfig = MpECMPSingleInterfaceConfig(
|
||||
self.Topo,
|
||||
self.topoParam)
|
||||
elif t == MpTopo.twoIfCongTopo:
|
||||
self.mpTopoConfig = MpTwoInterfaceCongestionConfig(
|
||||
self.mpTopo, self.topoParam)
|
||||
elif t == MpTopo.multiIfCongTopo:
|
||||
self.mpTopoConfig = MpMultiInterfaceCongConfig(self.mpTopo,
|
||||
elif t == Topo.twoIfCongTopo:
|
||||
self.TopoConfig = MpTwoInterfaceCongestionConfig(
|
||||
self.Topo, self.topoParam)
|
||||
elif t == Topo.multiIfCongTopo:
|
||||
self.TopoConfig = MpMultiInterfaceCongConfig(self.Topo,
|
||||
self.topoParam)
|
||||
else:
|
||||
raise Exception("Unfound Topo" + t)
|
||||
|
||||
def startTopo(self):
|
||||
self.mpTopo.startNetwork()
|
||||
self.mpTopoConfig.configureNetwork()
|
||||
self.Topo.startNetwork()
|
||||
self.TopoConfig.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)
|
||||
elif xp == MpExperience.HTTP:
|
||||
MpExperienceHTTP(self.xpParam, self.mpTopo,
|
||||
self.mpTopoConfig)
|
||||
elif xp == MpExperience.EPLOAD:
|
||||
MpExperienceEpload(self.xpParam, self.mpTopo,
|
||||
self.mpTopoConfig)
|
||||
elif xp == MpExperience.NETPERF:
|
||||
MpExperienceNetperf(self.xpParam, self.mpTopo,
|
||||
self.mpTopoConfig)
|
||||
elif xp == MpExperience.AB:
|
||||
MpExperienceAb(self.xpParam, self.mpTopo,
|
||||
self.mpTopoConfig)
|
||||
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)
|
||||
elif xp == MpExperience.IPERF:
|
||||
MpExperienceIperf(self.xpParam, self.mpTopo,
|
||||
self.mpTopoConfig)
|
||||
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)
|
||||
elif xp == MpExperience.QUIC:
|
||||
MpExperienceQUIC(self.xpParam, self.mpTopo, self.mpTopoConfig)
|
||||
elif xp == MpExperience.QUICSIRI:
|
||||
MpExperienceQUICSiri(self.xpParam, self.mpTopo, self.mpTopoConfig)
|
||||
xp = self.xpParam.getParam(ExperienceParameter.XPTYPE)
|
||||
if xp ==Experience.PING:
|
||||
ExperiencePing(self.xpParam, self.Topo,
|
||||
self.TopoConfig)
|
||||
elif xp ==Experience.NCPV:
|
||||
ExperienceNCPV(self.xpParam, self.Topo,
|
||||
self.TopoConfig)
|
||||
elif xp ==Experience.NC:
|
||||
ExperienceNC(self.xpParam, self.Topo,
|
||||
self.TopoConfig)
|
||||
elif xp ==Experience.NONE:
|
||||
ExperienceNone(self.xpParam, self.Topo,
|
||||
self.TopoConfig)
|
||||
elif xp ==Experience.HTTPS:
|
||||
ExperienceHTTPS(self.xpParam, self.Topo,
|
||||
self.TopoConfig)
|
||||
elif xp ==Experience.HTTP:
|
||||
ExperienceHTTP(self.xpParam, self.Topo,
|
||||
self.TopoConfig)
|
||||
elif xp ==Experience.EPLOAD:
|
||||
ExperienceEpload(self.xpParam, self.Topo,
|
||||
self.TopoConfig)
|
||||
elif xp ==Experience.NETPERF:
|
||||
ExperienceNetperf(self.xpParam, self.Topo,
|
||||
self.TopoConfig)
|
||||
elif xp ==Experience.AB:
|
||||
ExperienceAb(self.xpParam, self.Topo,
|
||||
self.TopoConfig)
|
||||
elif xp ==Experience.SIRI:
|
||||
ExperienceSiri(self.xpParam, self.Topo,
|
||||
self.TopoConfig)
|
||||
elif xp ==Experience.SENDFILE:
|
||||
ExperienceSendFile(self.xpParam, self.Topo,
|
||||
self.TopoConfig)
|
||||
elif xp ==Experience.VLC:
|
||||
ExperienceVLC(self.xpParam, self.Topo,
|
||||
self.TopoConfig)
|
||||
elif xp ==Experience.IPERF:
|
||||
ExperienceIperf(self.xpParam, self.Topo,
|
||||
self.TopoConfig)
|
||||
elif xp ==Experience.DITG:
|
||||
ExperienceDITG(self.xpParam, self.Topo, self.TopoConfig)
|
||||
elif xp ==Experience.MSG:
|
||||
ExperienceMsg(self.xpParam, self.Topo, self.TopoConfig)
|
||||
elif xp ==Experience.SIRIHTTP:
|
||||
ExperienceSiriHTTP(self.xpParam, self.Topo, self.TopoConfig)
|
||||
elif xp ==Experience.SIRIMSG:
|
||||
ExperienceSiriMsg(self.xpParam, self.Topo, self.TopoConfig)
|
||||
elif xp ==Experience.QUIC:
|
||||
ExperienceQUIC(self.xpParam, self.Topo, self.TopoConfig)
|
||||
elif xp ==Experience.QUICSIRI:
|
||||
ExperienceQUICSiri(self.xpParam, self.Topo, self.TopoConfig)
|
||||
else:
|
||||
print("Unfound xp type..." + xp)
|
||||
|
||||
def stopTopo(self):
|
||||
self.mpTopo.stopNetwork()
|
||||
self.Topo.stopNetwork()
|
||||
|
Loading…
Reference in New Issue
Block a user