start cleaning up the code

This commit is contained in:
Quentin De Coninck 2020-06-24 10:36:26 +02:00
parent 779f4da011
commit e5042cc296
38 changed files with 1027 additions and 1057 deletions

0
__init__.py Normal file
View File

0
core/__init__.py Normal file
View File

View File

@ -1,7 +1,7 @@
from mpParamXp import MpParamXp from .parameter import ExperienceParameter
from mpMultiInterfaceTopo import MpMultiInterfaceTopo from mpMultiInterfaceTopo import MpMultiInterfaceTopo
class MpExperience: class Experience:
PING = "ping" PING = "ping"
NCPV = "ncpv" NCPV = "ncpv"
NC = "nc" NC = "nc"
@ -45,15 +45,15 @@ class MpExperience:
pass pass
def changeMetric(self): def changeMetric(self):
metric = self.xpParam.getParam(MpParamXp.METRIC) metric = self.xpParam.getParam(ExperienceParameter.METRIC)
if int(metric) >= 0: if int(metric) >= 0:
self.mpTopo.notNSCommand("echo " + metric + " > /sys/module/mptcp_sched_metric/parameters/metric") self.mpTopo.notNSCommand("echo " + metric + " > /sys/module/mptcp_sched_metric/parameters/metric")
def putPriorityOnPaths(self): def putPriorityOnPaths(self):
# Only meaningful if mpTopo is instance of MpMultiInterfaceTopo # Only meaningful if mpTopo is instance of MpMultiInterfaceTopo
if isinstance(self.mpTopo, MpMultiInterfaceTopo): if isinstance(self.mpTopo, MpMultiInterfaceTopo):
prioPath0 = self.xpParam.getParam(MpParamXp.PRIOPATH0) prioPath0 = self.xpParam.getParam(ExperienceParameter.PRIOPATH0)
prioPath1 = self.xpParam.getParam(MpParamXp.PRIOPATH1) prioPath1 = self.xpParam.getParam(ExperienceParameter.PRIOPATH1)
if not prioPath0 == prioPath1: if not prioPath0 == prioPath1:
self.mpTopo.commandTo(self.mpConfig.client, "/home/mininet/iproute/ip/ip link set dev " + self.mpTopo.commandTo(self.mpConfig.client, "/home/mininet/iproute/ip/ip link set dev " +
self.mpConfig.getClientInterface(0) + " priority " + str(prioPath0)) self.mpConfig.getClientInterface(0) + " priority " + str(prioPath0))
@ -66,11 +66,11 @@ class MpExperience:
self.mpConfig.getRouterInterfaceSwitch(1) + " priority " + self.mpConfig.getRouterInterfaceSwitch(1) + " priority " +
str(prioPath1)) str(prioPath1))
backupPath0 = self.xpParam.getParam(MpParamXp.BACKUPPATH0) backupPath0 = self.xpParam.getParam(ExperienceParameter.BACKUPPATH0)
if int(backupPath0) > 0: if int(backupPath0) > 0:
self.mpTopo.commandTo(self.mpConfig.client, self.mpConfig.interfaceBUPCommand(self.mpConfig.getClientInterface(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))) 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: if int(backupPath1) > 0:
self.mpTopo.commandTo(self.mpConfig.client, self.mpConfig.interfaceBUPCommand(self.mpConfig.getClientInterface(1))) 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))) 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) self.mpTopo.commandTo(self.mpConfig.router, cmd)
def runUserspacePM(self): 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 !") print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !")
else: else:
upmc = self.xpParam.getParam(MpParamXp.USERPMC) upmc = self.xpParam.getParam(ExperienceParameter.USERPMC)
upmca = self.xpParam.getParam(MpParamXp.USERPMCARGS) upmca = self.xpParam.getParam(ExperienceParameter.USERPMCARGS)
self.mpTopo.commandTo(self.mpConfig.client, upmc + \ self.mpTopo.commandTo(self.mpConfig.client, upmc + \
" " + upmca + " &>upmc.log &") " " + 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 !") print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !")
else: else:
upms = self.xpParam.getParam(MpParamXp.USERPMS) upms = self.xpParam.getParam(ExperienceParameter.USERPMS)
upmsa = self.xpParam.getParam(MpParamXp.USERPMSARGS) upmsa = self.xpParam.getParam(ExperienceParameter.USERPMSARGS)
self.mpTopo.commandTo(self.mpConfig.server, upms + \ self.mpTopo.commandTo(self.mpConfig.server, upms + \
" " + upmsa + " &>upms.log &") " " + upmsa + " &>upms.log &")
def cleanUserspacePM(self): 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 !") print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !")
else: else:
upmc = self.xpParam.getParam(MpParamXp.USERPMC) upmc = self.xpParam.getParam(ExperienceParameter.USERPMC)
self.mpTopo.commandTo(self.mpConfig.client, "killall " + upmc) 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 !") print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !")
else: else:
upms = self.xpParam.getParam(MpParamXp.USERPMS) upms = self.xpParam.getParam(ExperienceParameter.USERPMS)
self.mpTopo.commandTo(self.mpConfig.server, "killall " + upms) self.mpTopo.commandTo(self.mpConfig.server, "killall " + upms)
def runNetemAt(self): def runNetemAt(self):
@ -191,12 +191,12 @@ class MpExperience:
def saveSysctl(self): def saveSysctl(self):
self.sysctlBUP = {} self.sysctlBUP = {}
self._saveSysctl(MpParamXp.sysctlKey, self.sysctlBUP) self._saveSysctl(ExperienceParameter.sysctlKey, self.sysctlBUP)
self.sysctlBUPC = {} self.sysctlBUPC = {}
self._saveSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC, self._saveSysctl(ExperienceParameter.sysctlKeyClient, self.sysctlBUPC,
ns = True, who = self.mpConfig.client) ns = True, who = self.mpConfig.client)
self.sysctlBUPS = {} self.sysctlBUPS = {}
self._saveSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS, self._saveSysctl(ExperienceParameter.sysctlKeyServer, self.sysctlBUPS,
ns = True, who = self.mpConfig.server) ns = True, who = self.mpConfig.server)
def _saveSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): def _saveSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None):
@ -226,10 +226,10 @@ class MpExperience:
return s return s
def writeSysctl(self): def writeSysctl(self):
self._writeSysctl(MpParamXp.sysctlKey, self.sysctlBUP) self._writeSysctl(ExperienceParameter.sysctlKey, self.sysctlBUP)
self._writeSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC, self._writeSysctl(ExperienceParameter.sysctlKeyClient, self.sysctlBUPC,
ns = True, who = self.mpConfig.client) ns = True, who = self.mpConfig.client)
self._writeSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS, self._writeSysctl(ExperienceParameter.sysctlKeyServer, self.sysctlBUPS,
ns = True, who = self.mpConfig.server) ns = True, who = self.mpConfig.server)
def _writeSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): def _writeSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None):
@ -246,10 +246,10 @@ class MpExperience:
def backUpSysctl(self): def backUpSysctl(self):
self._backUpSysctl(MpParamXp.sysctlKey, self.sysctlBUP) self._backUpSysctl(ExperienceParameter.sysctlKey, self.sysctlBUP)
self._backUpSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC, self._backUpSysctl(ExperienceParameter.sysctlKeyClient, self.sysctlBUPC,
ns = True, who = self.mpConfig.client) ns = True, who = self.mpConfig.client)
self._backUpSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS, self._backUpSysctl(ExperienceParameter.sysctlKeyServer, self.sysctlBUPS,
ns = True, who = self.mpConfig.server) ns = True, who = self.mpConfig.server)
@ -269,9 +269,9 @@ class MpExperience:
def runTcpDump(self): def runTcpDump(self):
#todo : replace filename by cst #todo : replace filename by cst
cpcap = self.xpParam.getParam(MpParamXp.CLIENTPCAP) cpcap = self.xpParam.getParam(ExperienceParameter.CLIENTPCAP)
spcap = self.xpParam.getParam(MpParamXp.SERVERPCAP) spcap = self.xpParam.getParam(ExperienceParameter.SERVERPCAP)
snaplenpcap = self.xpParam.getParam(MpParamXp.SNAPLENPCAP) snaplenpcap = self.xpParam.getParam(ExperienceParameter.SNAPLENPCAP)
if cpcap == "yes" : if cpcap == "yes" :
self.mpTopo.commandTo(self.mpConfig.client, self.mpTopo.commandTo(self.mpConfig.client,
"tcpdump -i any -s " + snaplenpcap + " -w client.pcap &") "tcpdump -i any -s " + snaplenpcap + " -w client.pcap &")

View File

@ -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" RMEM = "rmem"
WMEM = "wmem" WMEM = "wmem"
@ -166,18 +208,16 @@ class MpParamXp(MpParam):
defaultValue[BACKUPPATH1] = "0" defaultValue[BACKUPPATH1] = "0"
def __init__(self, paramFile): def __init__(self, paramFile):
MpParam.__init__(self, paramFile) super().__init__(paramFile)
def getParam(self, key): def getParam(self, key):
val = MpParam.getParam(self, key) val = super().getParam(key)
if val is None: if val is None:
if key in MpParamXp.defaultValue: if key in ExperienceParameter.defaultValue:
return MpParamXp.defaultValue[key] return ExperienceParameter.defaultValue[key]
else: else:
raise Exception("Param not found " + key) raise Exception("Parameter not found " + key)
else: else:
return val return val
def __str__(self):
s = MpParam.__str__(self)
return s

232
core/topo.py Normal file
View 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

View File

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

View File

@ -1,12 +1,10 @@
from mpConfig import MpConfig from core.topo import Topo, TopoConfig, TopoParameter
from mpECMPSingleInterfaceTopo import MpECMPSingleInterfaceTopo from mpECMPSingleInterfaceTopo import MpECMPSingleInterfaceTopo
from mpParamTopo import MpParamTopo
from mpTopo import MpTopo
from struct import * from struct import *
class MpECMPSingleInterfaceConfig(MpConfig): class MpECMPSingleInterfaceConfig(TopoConfig):
def __init__(self, topo, param): def __init__(self, topo, param):
MpConfig.__init__(self, topo, param) super().__init__(topo, param)
def configureRoute(self): def configureRoute(self):
i = 0 i = 0
@ -86,14 +84,14 @@ class MpECMPSingleInterfaceConfig(MpConfig):
return s return s
def configureInterfaces(self): def configureInterfaces(self):
self.client = self.topo.getHost(MpTopo.clientName) self.client = self.topo.getHost(Topo.clientName)
self.server = self.topo.getHost(MpTopo.serverName) self.server = self.topo.getHost(Topo.serverName)
self.routers = [] self.routers = []
i = 0 i = 0
netmask = "255.255.255.0" netmask = "255.255.255.0"
for l in self.topo.routers: for l in self.topo.routers:
self.routers.append(self.topo.getHost( self.routers.append(self.topo.getHost(
MpTopo.routerNamePrefix + str(i))) Topo.routerNamePrefix + str(i)))
cmd = self.interfaceUpCommand( cmd = self.interfaceUpCommand(
self.getRouterInterfaceLSwitch(i), self.getRouterInterfaceLSwitch(i),
self.getRouterIPClient(i), netmask) self.getRouterIPClient(i), netmask)
@ -115,27 +113,27 @@ class MpECMPSingleInterfaceConfig(MpConfig):
self.topo.commandTo(self.server, cmd) self.topo.commandTo(self.server, cmd)
def getClientIP(self, interfaceID): def getClientIP(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
clientIP = lSubnet + str(interfaceID) + ".1" clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP return clientIP
def getClientSubnet(self, interfaceID): def getClientSubnet(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
clientSubnet = lSubnet + str(interfaceID) + ".0/24" clientSubnet = lSubnet + str(interfaceID) + ".0/24"
return clientSubnet return clientSubnet
def getRouterIPClient(self, id): def getRouterIPClient(self, id):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
routerIP = lSubnet + "0." + str(id + 2) routerIP = lSubnet + "0." + str(id + 2)
return routerIP return routerIP
def getRouterIPServer(self, id): def getRouterIPServer(self, id):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(TopoParameter.RSUBNET)
routerIP = rSubnet + "0." + str(id + 2) routerIP = rSubnet + "0." + str(id + 2)
return routerIP return routerIP
def getServerIP(self): def getServerIP(self):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(TopoParameter.RSUBNET)
serverIP = rSubnet + "0.1" serverIP = rSubnet + "0.1"
return serverIP return serverIP
@ -143,22 +141,22 @@ class MpECMPSingleInterfaceConfig(MpConfig):
return 1 return 1
def getRouterInterfaceLSwitch(self, id): def getRouterInterfaceLSwitch(self, id):
return MpTopo.routerNamePrefix + str(id) + "-eth0" return Topo.routerNamePrefix + str(id) + "-eth0"
def getRouterInterfaceRSwitch(self, id): def getRouterInterfaceRSwitch(self, id):
return MpTopo.routerNamePrefix + str(id) + "-eth1" return Topo.routerNamePrefix + str(id) + "-eth1"
def getClientInterface(self, interfaceID): def getClientInterface(self, interfaceID):
return MpTopo.clientName + "-eth" + str(interfaceID) return Topo.clientName + "-eth" + str(interfaceID)
def getServerInterface(self): def getServerInterface(self):
return MpTopo.serverName + "-eth0" return Topo.serverName + "-eth0"
def getMidLeftName(self, id): def getMidLeftName(self, id):
return MpTopo.routerNamePrefix + str(id) return Topo.routerNamePrefix + str(id)
def getMidRightName(self, id): def getMidRightName(self, id):
return MpTopo.switchNamePrefix + "1" return Topo.switchNamePrefix + "1"
def getMidL2RInterface(self, id): def getMidL2RInterface(self, id):
return self.getMidLeftName(id) + "-eth1" return self.getMidLeftName(id) + "-eth1"

View File

@ -1,15 +1,15 @@
from mpTopo import MpTopo from core.topo import Topo
class MpECMPSingleInterfaceTopo(MpTopo): class MpECMPSingleInterfaceTopo(Topo):
def __init__(self, topoBuilder, parameterFile): def __init__(self, topoBuilder, parameterFile):
MpTopo.__init__(self,topoBuilder, parameterFile) super().__init__(topoBuilder, parameterFile)
print("Hello ECMP topo") print("Hello ECMP topo")
self.client = self.addHost(MpTopo.clientName) self.client = self.addHost(Topo.clientName)
self.server = self.addHost(MpTopo.serverName) self.server = self.addHost(Topo.serverName)
self.lswitch = self.addSwitch(MpTopo.switchNamePrefix + "0") self.lswitch = self.addSwitch(Topo.switchNamePrefix + "0")
self.rswitch = self.addSwitch(MpTopo.switchNamePrefix + "1") self.rswitch = self.addSwitch(Topo.switchNamePrefix + "1")
self.addLink( self.client, self.lswitch) self.addLink( self.client, self.lswitch)
self.addLink( self.server, self.rswitch) self.addLink( self.server, self.rswitch)
@ -22,7 +22,7 @@ class MpECMPSingleInterfaceTopo(MpTopo):
self.addLink(self.rswitch, self.routers[-1], **l.asDict()) self.addLink(self.rswitch, self.routers[-1], **l.asDict())
def addOneRouterPerLink(self, link): def addOneRouterPerLink(self, link):
return self.addHost(MpTopo.routerNamePrefix + return self.addHost(Topo.routerNamePrefix +
str(link.id)) str(link.id))
def __str__(self): def __str__(self):

View File

@ -1,24 +1,23 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
from mpPvAt import MpPvAt from mpPvAt import MpPvAt
import os import os
class MpExperienceAb(MpExperience): class ExperienceAb(Experience):
SERVER_LOG = "ab_server.log" SERVER_LOG = "ab_server.log"
CLIENT_LOG = "ab_client.log" CLIENT_LOG = "ab_client.log"
AB_BIN = "ab" AB_BIN = "ab"
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, self.mpTopo.commandTo(self.mpConfig.client,
"rm " + MpExperienceAb.PING_OUTPUT) "rm " + ExperienceAb.PING_OUTPUT)
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -26,7 +25,7 @@ class MpExperienceAb(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceAb.PING_OUTPUT " >> " + ExperienceAb.PING_OUTPUT
print(s) print(s)
return s return s
@ -34,17 +33,17 @@ class MpExperienceAb(MpExperience):
""" """
todo : param LD_PRELOAD ?? todo : param LD_PRELOAD ??
""" """
self.file = self.xpParam.getParam(MpParamXp.HTTPFILE) self.file = self.xpParam.getParam(ExperienceParameter.HTTPFILE)
self.random_size = self.xpParam.getParam(MpParamXp.HTTPRANDOMSIZE) self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPRANDOMSIZE)
self.concurrent_requests = self.xpParam.getParam(MpParamXp.ABCONCURRENTREQUESTS) self.concurrent_requests = self.xpParam.getParam(ExperienceParameter.ABCONCURRENTREQUESTS)
self.timelimit = self.xpParam.getParam(MpParamXp.ABTIMELIMIT) self.timelimit = self.xpParam.getParam(ExperienceParameter.ABTIMELIMIT)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceAb.CLIENT_LOG ) ExperienceAb.CLIENT_LOG )
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceAb.SERVER_LOG ) ExperienceAb.SERVER_LOG )
if self.file == "random": if self.file == "random":
self.mpTopo.commandTo(self.mpConfig.client, self.mpTopo.commandTo(self.mpConfig.client,
"dd if=/dev/urandom of=random bs=1K count=" + \ "dd if=/dev/urandom of=random bs=1K count=" + \
@ -52,19 +51,19 @@ class MpExperienceAb(MpExperience):
def getAbServerCmd(self): def getAbServerCmd(self):
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \ s = "python " + os.path.dirname(os.path.abspath(__file__)) + \
"/http.py &>" + MpExperienceAb.SERVER_LOG + "&" "/http.py &>" + ExperienceAb.SERVER_LOG + "&"
print(s) print(s)
return s return s
def getAbClientCmd(self): 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 + \ self.timelimit + " http://" + self.mpConfig.getServerIP() + "/" + self.file + \
" &>" + MpExperienceAb.CLIENT_LOG " &>" + ExperienceAb.CLIENT_LOG
print(s) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
if self.file == "random": if self.file == "random":
self.mpTopo.commandTo(self.mpConfig.client, "rm random*") self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
#todo use cst #todo use cst

View File

@ -1,9 +1,8 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
from mpPvAt import MpPvAt from mpPvAt import MpPvAt
import os import os
class MpExperienceDITG(MpExperience): class ExperienceDITG(Experience):
DITG_LOG = "ditg.log" DITG_LOG = "ditg.log"
DITG_SERVER_LOG = "ditg_server.log" DITG_SERVER_LOG = "ditg_server.log"
ITGDEC_BIN = "/home/mininet/D-ITG-2.8.1-r1023/bin/ITGDec" 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): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceDITG.PING_OUTPUT) ExperienceDITG.PING_OUTPUT)
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -31,7 +30,7 @@ class MpExperienceDITG(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceDITG.PING_OUTPUT " >> " + ExperienceDITG.PING_OUTPUT
print(s) print(s)
return s return s
@ -39,22 +38,22 @@ class MpExperienceDITG(MpExperience):
""" """
todo : param LD_PRELOAD ?? todo : param LD_PRELOAD ??
""" """
self.kbytes = self.xpParam.getParam(MpParamXp.DITGKBYTES) self.kbytes = self.xpParam.getParam(ExperienceParameter.DITGKBYTES)
self.constant_packet_size = self.xpParam.getParam(MpParamXp.DITGCONSTANTPACKETSIZE) self.constant_packet_size = self.xpParam.getParam(ExperienceParameter.DITGCONSTANTPACKETSIZE)
self.mean_poisson_packets_sec = self.xpParam.getParam(MpParamXp.DITGMEANPOISSONPACKETSSEC) self.mean_poisson_packets_sec = self.xpParam.getParam(ExperienceParameter.DITGMEANPOISSONPACKETSSEC)
self.constant_packets_sec = self.xpParam.getParam(MpParamXp.DITGCONSTANTPACKETSSEC) self.constant_packets_sec = self.xpParam.getParam(ExperienceParameter.DITGCONSTANTPACKETSSEC)
self.bursts_on_packets_sec = self.xpParam.getParam(MpParamXp.DITGBURSTSONPACKETSSEC) self.bursts_on_packets_sec = self.xpParam.getParam(ExperienceParameter.DITGBURSTSONPACKETSSEC)
self.bursts_off_packets_sec = self.xpParam.getParam(MpParamXp.DITGBURSTSOFFPACKETSSEC) self.bursts_off_packets_sec = self.xpParam.getParam(ExperienceParameter.DITGBURSTSOFFPACKETSSEC)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + MpExperienceDITG.DITG_LOG) self.mpTopo.commandTo(self.mpConfig.client, "rm " + ExperienceDITG.DITG_LOG)
self.mpTopo.commandTo(self.mpConfig.server, "rm " + MpExperienceDITG.DITG_SERVER_LOG) self.mpTopo.commandTo(self.mpConfig.server, "rm " + ExperienceDITG.DITG_SERVER_LOG)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + MpExperienceDITG.DITG_TEMP_LOG) self.mpTopo.commandTo(self.mpConfig.client, "rm " + ExperienceDITG.DITG_TEMP_LOG)
def getClientCmd(self): def getClientCmd(self):
s = MpExperienceDITG.ITGSEND_BIN + " -a " + self.mpConfig.getServerIP() + \ s = ExperienceDITG.ITGSEND_BIN + " -a " + self.mpConfig.getServerIP() + \
" -T TCP -k " + self.kbytes + " -l " + MpExperienceDITG.DITG_TEMP_LOG " -T TCP -k " + self.kbytes + " -l " + ExperienceDITG.DITG_TEMP_LOG
if self.constant_packet_size != "0": if self.constant_packet_size != "0":
s += " -c " + self.constant_packet_size 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": 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 += " -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) print(s)
return s return s
def getServerCmd(self): 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) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
#todo use cst #todo use cst
#self.mpTopo.commandTo(self.mpConfig.server, "killall netcat") #self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
@ -88,5 +87,5 @@ class MpExperienceDITG(MpExperience):
cmd = self.getClientCmd() cmd = self.getClientCmd()
self.mpTopo.commandTo(self.mpConfig.client, cmd) self.mpTopo.commandTo(self.mpConfig.client, cmd)
self.mpTopo.commandTo(self.mpConfig.server, "pkill -9 -f ITGRecv") 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") self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")

View File

@ -1,9 +1,8 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
from mpPvAt import MpPvAt from mpPvAt import MpPvAt
import os import os
class MpExperienceEpload(MpExperience): class ExperienceEpload(Experience):
SERVER_LOG = "http_server.log" SERVER_LOG = "http_server.log"
EPLOAD_LOG = "epload.log" EPLOAD_LOG = "epload.log"
NODE_BIN = "/usr/local/nodejs/bin/node" NODE_BIN = "/usr/local/nodejs/bin/node"
@ -11,15 +10,15 @@ class MpExperienceEpload(MpExperience):
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceEpload.PING_OUTPUT ) ExperienceEpload.PING_OUTPUT )
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -27,22 +26,22 @@ class MpExperienceEpload(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceEpload.PING_OUTPUT " >> " + ExperienceEpload.PING_OUTPUT
print(s) print(s)
return s return s
def loadParam(self): def loadParam(self):
self.epload_test_dir = self.xpParam.getParam(MpParamXp.EPLOADTESTDIR) self.epload_test_dir = self.xpParam.getParam(ExperienceParameter.EPLOADTESTDIR)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceEpload.EPLOAD_LOG ) ExperienceEpload.EPLOAD_LOG )
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceEpload.SERVER_LOG ) ExperienceEpload.SERVER_LOG )
def getHTTPServerCmd(self): def getHTTPServerCmd(self):
s = "/etc/init.d/apache2 restart &>" + MpExperienceEpload.SERVER_LOG + " &" s = "/etc/init.d/apache2 restart &>" + ExperienceEpload.SERVER_LOG + " &"
print(s) print(s)
return s return s
@ -52,9 +51,9 @@ class MpExperienceEpload(MpExperience):
return s return s
def getEploadClientCmd(self): def getEploadClientCmd(self):
s = MpExperienceEpload.NODE_BIN + " " + MpExperienceEpload.EPLOAD_EMULATOR + \ s = ExperienceEpload.NODE_BIN + " " + ExperienceEpload.EPLOAD_EMULATOR + \
" http " + \ " http " + \
self.epload_test_dir + " &>" + MpExperienceEpload.EPLOAD_LOG self.epload_test_dir + " &>" + ExperienceEpload.EPLOAD_LOG
print(s) print(s)
return s return s
@ -73,7 +72,7 @@ class MpExperienceEpload(MpExperience):
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
def run(self): def run(self):
cmd = self.getHTTPServerCmd() cmd = self.getHTTPServerCmd()

View File

@ -1,24 +1,23 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
from mpPvAt import MpPvAt from mpPvAt import MpPvAt
import os import os
class MpExperienceHTTP(MpExperience): class ExperienceHTTP(Experience):
SERVER_LOG = "http_server.log" SERVER_LOG = "http_server.log"
CLIENT_LOG = "http_client.log" CLIENT_LOG = "http_client.log"
WGET_BIN = "wget" WGET_BIN = "wget"
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceHTTP.PING_OUTPUT ) ExperienceHTTP.PING_OUTPUT )
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -26,7 +25,7 @@ class MpExperienceHTTP(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceHTTP.PING_OUTPUT " >> " + ExperienceHTTP.PING_OUTPUT
print(s) print(s)
return s return s
@ -34,33 +33,33 @@ class MpExperienceHTTP(MpExperience):
""" """
todo : param LD_PRELOAD ?? todo : param LD_PRELOAD ??
""" """
self.file = self.xpParam.getParam(MpParamXp.HTTPFILE) self.file = self.xpParam.getParam(ExperienceParameter.HTTPFILE)
self.random_size = self.xpParam.getParam(MpParamXp.HTTPRANDOMSIZE) self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPRANDOMSIZE)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceHTTP.CLIENT_LOG ) ExperienceHTTP.CLIENT_LOG )
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceHTTP.SERVER_LOG ) ExperienceHTTP.SERVER_LOG )
if self.file == "random": if self.file == "random":
self.mpTopo.commandTo(self.mpConfig.client, self.mpTopo.commandTo(self.mpConfig.client,
"dd if=/dev/urandom of=random bs=1K count=" + \ "dd if=/dev/urandom of=random bs=1K count=" + \
self.random_size) self.random_size)
def getHTTPServerCmd(self): def getHTTPServerCmd(self):
s = "/etc/init.d/apache2 restart &>" + MpExperienceHTTP.SERVER_LOG + "&" s = "/etc/init.d/apache2 restart &>" + ExperienceHTTP.SERVER_LOG + "&"
print(s) print(s)
return s return s
def getHTTPClientCmd(self): def getHTTPClientCmd(self):
s = "(time " + MpExperienceHTTP.WGET_BIN + " http://" + self.mpConfig.getServerIP() + \ s = "(time " + ExperienceHTTP.WGET_BIN + " http://" + self.mpConfig.getServerIP() + \
"/" + self.file + " --no-check-certificate) &>" + MpExperienceHTTP.CLIENT_LOG "/" + self.file + " --no-check-certificate) &>" + ExperienceHTTP.CLIENT_LOG
print(s) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
if self.file == "random": if self.file == "random":
self.mpTopo.commandTo(self.mpConfig.client, "rm random*") self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
#todo use cst #todo use cst

View File

@ -1,24 +1,23 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
from mpPvAt import MpPvAt from mpPvAt import MpPvAt
import os import os
class MpExperienceHTTPS(MpExperience): class ExperienceHTTPS(Experience):
SERVER_LOG = "https_server.log" SERVER_LOG = "https_server.log"
CLIENT_LOG = "https_client.log" CLIENT_LOG = "https_client.log"
WGET_BIN = "wget" WGET_BIN = "wget"
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceHTTPS.PING_OUTPUT ) ExperienceHTTPS.PING_OUTPUT )
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -26,7 +25,7 @@ class MpExperienceHTTPS(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceHTTPS.PING_OUTPUT " >> " + ExperienceHTTPS.PING_OUTPUT
print(s) print(s)
return s return s
@ -34,15 +33,15 @@ class MpExperienceHTTPS(MpExperience):
""" """
todo : param LD_PRELOAD ?? todo : param LD_PRELOAD ??
""" """
self.file = self.xpParam.getParam(MpParamXp.HTTPSFILE) self.file = self.xpParam.getParam(ExperienceParameter.HTTPSFILE)
self.random_size = self.xpParam.getParam(MpParamXp.HTTPSRANDOMSIZE) self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPSRANDOMSIZE)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceHTTPS.CLIENT_LOG ) ExperienceHTTPS.CLIENT_LOG )
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceHTTPS.SERVER_LOG ) ExperienceHTTPS.SERVER_LOG )
if self.file == "random": if self.file == "random":
self.mpTopo.commandTo(self.mpConfig.client, self.mpTopo.commandTo(self.mpConfig.client,
"dd if=/dev/urandom of=random bs=1K count=" + \ "dd if=/dev/urandom of=random bs=1K count=" + \
@ -50,18 +49,18 @@ class MpExperienceHTTPS(MpExperience):
def getHTTPSServerCmd(self): def getHTTPSServerCmd(self):
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \ s = "python " + os.path.dirname(os.path.abspath(__file__)) + \
"/https.py &>" + MpExperienceHTTPS.SERVER_LOG + "&" "/https.py &>" + ExperienceHTTPS.SERVER_LOG + "&"
print(s) print(s)
return s return s
def getHTTPSClientCmd(self): def getHTTPSClientCmd(self):
s = "(time " +MpExperienceHTTPS.WGET_BIN + " https://" + self.mpConfig.getServerIP() + \ s = "(time " +ExperienceHTTPS.WGET_BIN + " https://" + self.mpConfig.getServerIP() + \
"/" + self.file + " --no-check-certificate) &>" + MpExperienceHTTPS.CLIENT_LOG "/" + self.file + " --no-check-certificate) &>" + ExperienceHTTPS.CLIENT_LOG
print(s) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
if self.file == "random": if self.file == "random":
self.mpTopo.commandTo(self.mpConfig.client, "rm random*") self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
#todo use cst #todo use cst

View File

@ -1,24 +1,23 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
from mpPvAt import MpPvAt from mpPvAt import MpPvAt
import os import os
class MpExperienceIperf(MpExperience): class ExperienceIperf(Experience):
IPERF_LOG = "iperf.log" IPERF_LOG = "iperf.log"
SERVER_LOG = "server.log" SERVER_LOG = "server.log"
IPERF_BIN = "iperf3" IPERF_BIN = "iperf3"
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceIperf.PING_OUTPUT) ExperienceIperf.PING_OUTPUT)
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -26,7 +25,7 @@ class MpExperienceIperf(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceIperf.PING_OUTPUT " >> " + ExperienceIperf.PING_OUTPUT
print(s) print(s)
return s return s
@ -34,30 +33,30 @@ class MpExperienceIperf(MpExperience):
""" """
todo : param LD_PRELOAD ?? todo : param LD_PRELOAD ??
""" """
self.time = self.xpParam.getParam(MpParamXp.IPERFTIME) self.time = self.xpParam.getParam(ExperienceParameter.IPERFTIME)
self.parallel = self.xpParam.getParam(MpParamXp.IPERFPARALLEL) self.parallel = self.xpParam.getParam(ExperienceParameter.IPERFPARALLEL)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + self.mpTopo.commandTo(self.mpConfig.client, "rm " +
MpExperienceIperf.IPERF_LOG) ExperienceIperf.IPERF_LOG)
self.mpTopo.commandTo(self.mpConfig.server, "rm " + self.mpTopo.commandTo(self.mpConfig.server, "rm " +
MpExperienceIperf.SERVER_LOG) ExperienceIperf.SERVER_LOG)
def getClientCmd(self): def getClientCmd(self):
s = MpExperienceIperf.IPERF_BIN + " -c " + self.mpConfig.getServerIP() + \ s = ExperienceIperf.IPERF_BIN + " -c " + self.mpConfig.getServerIP() + \
" -t " + self.time + " -P " + self.parallel + " &>" + MpExperienceIperf.IPERF_LOG " -t " + self.time + " -P " + self.parallel + " &>" + ExperienceIperf.IPERF_LOG
print(s) print(s)
return s return s
def getServerCmd(self): def getServerCmd(self):
s = "sudo " + MpExperienceIperf.IPERF_BIN + " -s &>" + \ s = "sudo " + ExperienceIperf.IPERF_BIN + " -s &>" + \
MpExperienceIperf.SERVER_LOG + "&" ExperienceIperf.SERVER_LOG + "&"
print(s) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
#todo use cst #todo use cst
#self.mpTopo.commandTo(self.mpConfig.server, "killall netcat") #self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")

View File

@ -1,23 +1,22 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
import os import os
class MpExperienceMsg(MpExperience): class ExperienceMsg(Experience):
SERVER_LOG = "msg_server.log" SERVER_LOG = "msg_server.log"
CLIENT_LOG = "msg_client.log" CLIENT_LOG = "msg_client.log"
CLIENT_ERR = "msg_client.err" CLIENT_ERR = "msg_client.err"
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceMsg.PING_OUTPUT ) ExperienceMsg.PING_OUTPUT )
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -25,7 +24,7 @@ class MpExperienceMsg(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceMsg.PING_OUTPUT " >> " + ExperienceMsg.PING_OUTPUT
print(s) print(s)
return s return s
@ -33,33 +32,33 @@ class MpExperienceMsg(MpExperience):
""" """
todo : param LD_PRELOAD ?? todo : param LD_PRELOAD ??
""" """
self.client_sleep = self.xpParam.getParam(MpParamXp.MSGCLIENTSLEEP) self.client_sleep = self.xpParam.getParam(ExperienceParameter.MSGCLIENTSLEEP)
self.server_sleep = self.xpParam.getParam(MpParamXp.MSGSERVERSLEEP) self.server_sleep = self.xpParam.getParam(ExperienceParameter.MSGSERVERSLEEP)
self.nb_requests = self.xpParam.getParam(MpParamXp.MSGNBREQUESTS) self.nb_requests = self.xpParam.getParam(ExperienceParameter.MSGNBREQUESTS)
self.bytes = self.xpParam.getParam(MpParamXp.MSGBYTES) self.bytes = self.xpParam.getParam(ExperienceParameter.MSGBYTES)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceMsg.CLIENT_LOG) ExperienceMsg.CLIENT_LOG)
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceMsg.SERVER_LOG) ExperienceMsg.SERVER_LOG)
def getMsgServerCmd(self): def getMsgServerCmd(self):
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \ 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) print(s)
return s return s
def getMsgClientCmd(self): def getMsgClientCmd(self):
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \ s = "python " + os.path.dirname(os.path.abspath(__file__)) + \
"/msg_client.py --sleep " + self.client_sleep + " --nb " + self.nb_requests + \ "/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) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
def run(self): def run(self):

View File

@ -1,67 +1,66 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
from mpPvAt import MpPvAt from mpPvAt import MpPvAt
""" """
Should be the mother of MpExperienceNCPV, shame on me, should rewrite Should be the mother of ExperienceNCPV, shame on me, should rewrite
MpExperienceNCPV as daughter class of this one. ExperienceNCPV as daughter class of this one.
""" """
class MpExperienceNC(MpExperience): class ExperienceNC(Experience):
SERVER_NC_LOG = "netcat_server" SERVER_NC_LOG = "netcat_server"
CLIENT_NC_LOG = "netcat_client" CLIENT_NC_LOG = "netcat_client"
NC_BIN = "netcat" NC_BIN = "netcat"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
MpExperience.classicRun(self) Experience.classicRun(self)
def loadParam(self): def loadParam(self):
self.ddibs = self.xpParam.getParam(MpParamXp.DDIBS) self.ddibs = self.xpParam.getParam(ExperienceParameter.DDIBS)
self.ddobs = self.xpParam.getParam(MpParamXp.DDOBS) self.ddobs = self.xpParam.getParam(ExperienceParameter.DDOBS)
self.ddcount = self.xpParam.getParam(MpParamXp.DDCOUNT) self.ddcount = self.xpParam.getParam(ExperienceParameter.DDCOUNT)
self.ncServerPort = self.xpParam.getParam(MpParamXp.NCSERVERPORT) self.ncServerPort = self.xpParam.getParam(ExperienceParameter.NCSERVERPORT)
self.ncClientPort = [] self.ncClientPort = []
for k in sorted(self.xpParam.paramDic): for k in sorted(self.xpParam.paramDic):
if k.startswith(MpParamXp.NCCLIENTPORT): if k.startswith(ExperienceParameter.NCCLIENTPORT):
port = self.xpParam.paramDic[k] port = self.xpParam.paramDic[k]
self.ncClientPort.append(port) self.ncClientPort.append(port)
if len(self.ncClientPort) == 0: if len(self.ncClientPort) == 0:
d = self.xpParam.getParam(MpParamXp.NCCLIENTPORT) d = self.xpParam.getParam(ExperienceParameter.NCCLIENTPORT)
self.ncClientPort.append(d) self.ncClientPort.append(d)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceNC.CLIENT_NC_LOG ) ExperienceNC.CLIENT_NC_LOG )
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceNC.SERVER_NC_LOG ) ExperienceNC.SERVER_NC_LOG )
def getNCServerCmd(self, id): def getNCServerCmd(self, id):
s = "dd if=/dev/urandom ibs=" + self.ddibs + \ s = "dd if=/dev/urandom ibs=" + self.ddibs + \
" obs=" + self.ddobs + \ " obs=" + self.ddobs + \
" count=" + self.ddcount + \ " count=" + self.ddcount + \
" | " + \ " | " + \
MpExperienceNC.NC_BIN + \ ExperienceNC.NC_BIN + \
" -l " + self.ncServerPort + \ " -l " + self.ncServerPort + \
" &>" + MpExperienceNC.SERVER_NC_LOG + \ " &>" + ExperienceNC.SERVER_NC_LOG + \
"_" + str(id) + ".log" "_" + str(id) + ".log"
print(s) print(s)
return s return s
def getNCClientCmd(self, id): def getNCClientCmd(self, id):
s = MpExperienceNC.NC_BIN + " " + \ s = ExperienceNC.NC_BIN + " " + \
" -p " + self.ncClientPort[id] + " " + \ " -p " + self.ncClientPort[id] + " " + \
self.mpConfig.getServerIP() + " " + \ self.mpConfig.getServerIP() + " " + \
self.ncServerPort + " " + \ self.ncServerPort + " " + \
"&>" + MpExperienceNC.CLIENT_NC_LOG + \ "&>" + ExperienceNC.CLIENT_NC_LOG + \
"_" + str(id) + ".log" "_" + str(id) + ".log"
print(s) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
#todo use cst #todo use cst
self.mpTopo.commandTo(self.mpConfig.server, "killall netcat") self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")

View File

@ -1,8 +1,7 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
from mpPvAt import MpPvAt from mpPvAt import MpPvAt
class MpExperienceNCPV(MpExperience): class ExperienceNCPV(Experience):
""" """
NC PV : NetCat and Pipe Viewer NC PV : NetCat and Pipe Viewer
""" """
@ -13,15 +12,15 @@ class MpExperienceNCPV(MpExperience):
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceNCPV.PING_OUTPUT ) ExperienceNCPV.PING_OUTPUT )
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -29,36 +28,36 @@ class MpExperienceNCPV(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceNCPV.PING_OUTPUT " >> " + ExperienceNCPV.PING_OUTPUT
print(s) print(s)
return s return s
def loadParam(self): def loadParam(self):
self.pvg = self.xpParam.getParam(MpParamXp.PVG) self.pvg = self.xpParam.getParam(ExperienceParameter.PVG)
self.pvz = self.xpParam.getParam(MpParamXp.PVZ) self.pvz = self.xpParam.getParam(ExperienceParameter.PVZ)
self.pvRateLimit = self.xpParam.getParam(MpParamXp.PVRATELIMIT) self.pvRateLimit = self.xpParam.getParam(ExperienceParameter.PVRATELIMIT)
self.ddibs = self.xpParam.getParam(MpParamXp.DDIBS) self.ddibs = self.xpParam.getParam(ExperienceParameter.DDIBS)
self.ddobs = self.xpParam.getParam(MpParamXp.DDOBS) self.ddobs = self.xpParam.getParam(ExperienceParameter.DDOBS)
self.ddcount = self.xpParam.getParam(MpParamXp.DDCOUNT) self.ddcount = self.xpParam.getParam(ExperienceParameter.DDCOUNT)
self.ncServerPort = self.xpParam.getParam(MpParamXp.NCSERVERPORT) self.ncServerPort = self.xpParam.getParam(ExperienceParameter.NCSERVERPORT)
self.pvRateLimit = self.xpParam.getParam(MpParamXp.PVRATELIMIT) self.pvRateLimit = self.xpParam.getParam(ExperienceParameter.PVRATELIMIT)
self.ncClientPort = [] self.ncClientPort = []
for k in sorted(self.xpParam.paramDic): for k in sorted(self.xpParam.paramDic):
if k.startswith(MpParamXp.NCCLIENTPORT): if k.startswith(ExperienceParameter.NCCLIENTPORT):
port = self.xpParam.paramDic[k] port = self.xpParam.paramDic[k]
self.ncClientPort.append(port) self.ncClientPort.append(port)
if len(self.ncClientPort) == 0: if len(self.ncClientPort) == 0:
d = self.xpParam.getParam(MpParamXp.NCCLIENTPORT) d = self.xpParam.getParam(ExperienceParameter.NCCLIENTPORT)
self.ncClientPort.append(d) self.ncClientPort.append(d)
self.loadPvAt() self.loadPvAt()
def loadPvAt(self): def loadPvAt(self):
self.changePvAt = [] self.changePvAt = []
self.changePv = self.xpParam.getParam(MpParamXp.CHANGEPV) self.changePv = self.xpParam.getParam(ExperienceParameter.CHANGEPV)
if self.changePv != "yes": if self.changePv != "yes":
print("Don't change pv rate...") print("Don't change pv rate...")
return return
changePvAt = self.xpParam.getParam(MpParamXp.CHANGEPVAT) changePvAt = self.xpParam.getParam(ExperienceParameter.CHANGEPVAT)
if not isinstance(changePvAt, list): if not isinstance(changePvAt, list):
changePvAt = [changePvAt] changePvAt = [changePvAt]
for p in changePvAt: for p in changePvAt:
@ -67,7 +66,7 @@ class MpExperienceNCPV(MpExperience):
o = MpPvAt(float(tab[0]), tab[1]) o = MpPvAt(float(tab[0]), tab[1])
self.addPvAt(o) self.addPvAt(o)
else: else:
print("pv wrong line : " + n) print("pv wrong line : " + p)
def addPvAt(self, p): def addPvAt(self, p):
if len(self.changePvAt) == 0 : if len(self.changePvAt) == 0 :
@ -87,22 +86,22 @@ class MpExperienceNCPV(MpExperience):
for p in self.changePvAt: for p in self.changePvAt:
cmd = cmd + "sleep " + str(p.delta) cmd = cmd + "sleep " + str(p.delta)
cmd = cmd + " && " cmd = cmd + " && "
cmd = cmd + MpExperienceNCPV.PV_BIN + " -R " + self.pvPid cmd = cmd + ExperienceNCPV.PV_BIN + " -R " + self.pvPid
cmd = cmd + " " + p.cmd + " && " cmd = cmd + " " + p.cmd + " && "
cmd = cmd + " true &" cmd = cmd + " true &"
return cmd return cmd
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceNCPV.CLIENT_NC_LOG ) ExperienceNCPV.CLIENT_NC_LOG )
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceNCPV.SERVER_NC_LOG ) ExperienceNCPV.SERVER_NC_LOG )
def getNCServerCmd(self, id): def getNCServerCmd(self, id):
s = MpExperienceNCPV.NC_BIN + " -d " + \ s = ExperienceNCPV.NC_BIN + " -d " + \
" -l " + self.ncServerPort + \ " -l " + self.ncServerPort + \
" 1>/dev/null 2>" + MpExperienceNCPV.SERVER_NC_LOG + \ " 1>/dev/null 2>" + ExperienceNCPV.SERVER_NC_LOG + \
"_" + str(id) + ".log &" "_" + str(id) + ".log &"
print(s) print(s)
return s return s
@ -111,14 +110,14 @@ class MpExperienceNCPV(MpExperience):
s = "dd if=/dev/urandom ibs=" + self.ddibs + \ s = "dd if=/dev/urandom ibs=" + self.ddibs + \
" obs=" + self.ddobs + \ " obs=" + self.ddobs + \
" count=" + self.ddcount + \ " count=" + self.ddcount + \
" | " + MpExperienceNCPV.PV_BIN + \ " | " + ExperienceNCPV.PV_BIN + \
" -g " + self.pvg + " -z " + self.pvz + \ " -g " + self.pvg + " -z " + self.pvz + \
" -q --rate-limit " + self.pvRateLimit + \ " -q --rate-limit " + self.pvRateLimit + \
" | " + MpExperienceNCPV.NC_BIN + " " + \ " | " + ExperienceNCPV.NC_BIN + " " + \
" -p " + self.ncClientPort[id] + " " + \ " -p " + self.ncClientPort[id] + " " + \
self.mpConfig.getServerIP() + " " + \ self.mpConfig.getServerIP() + " " + \
self.ncServerPort + " " + \ self.ncServerPort + " " + \
"&>" + MpExperienceNCPV.CLIENT_NC_LOG + \ "&>" + ExperienceNCPV.CLIENT_NC_LOG + \
"_" + str(id) + ".log" "_" + str(id) + ".log"
print(s) print(s)
return s return s
@ -127,7 +126,7 @@ class MpExperienceNCPV(MpExperience):
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
#todo use cst #todo use cst
self.mpTopo.commandTo(self.mpConfig.server, "killall netcat") self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")

View File

@ -1,9 +1,8 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
from mpPvAt import MpPvAt from mpPvAt import MpPvAt
import os import os
class MpExperienceNetperf(MpExperience): class ExperienceNetperf(Experience):
NETPERF_LOG = "netperf.log" NETPERF_LOG = "netperf.log"
NETSERVER_LOG = "netserver.log" NETSERVER_LOG = "netserver.log"
NETPERF_BIN = "netperf" NETPERF_BIN = "netperf"
@ -11,15 +10,15 @@ class MpExperienceNetperf(MpExperience):
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceNetperf.PING_OUTPUT) ExperienceNetperf.PING_OUTPUT)
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -27,7 +26,7 @@ class MpExperienceNetperf(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceNetperf.PING_OUTPUT " >> " + ExperienceNetperf.PING_OUTPUT
print(s) print(s)
return s return s
@ -35,32 +34,32 @@ class MpExperienceNetperf(MpExperience):
""" """
todo : param LD_PRELOAD ?? todo : param LD_PRELOAD ??
""" """
self.testlen = self.xpParam.getParam(MpParamXp.NETPERFTESTLEN) self.testlen = self.xpParam.getParam(ExperienceParameter.NETPERFTESTLEN)
self.testname = self.xpParam.getParam(MpParamXp.NETPERFTESTNAME) self.testname = self.xpParam.getParam(ExperienceParameter.NETPERFTESTNAME)
self.reqres_size = self.xpParam.getParam(MpParamXp.NETPERFREQRESSIZE) self.reqres_size = self.xpParam.getParam(ExperienceParameter.NETPERFREQRESSIZE)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + self.mpTopo.commandTo(self.mpConfig.client, "rm " +
MpExperienceNetperf.NETPERF_LOG) ExperienceNetperf.NETPERF_LOG)
self.mpTopo.commandTo(self.mpConfig.server, "rm " + self.mpTopo.commandTo(self.mpConfig.server, "rm " +
MpExperienceNetperf.NETSERVER_LOG) ExperienceNetperf.NETSERVER_LOG)
def getClientCmd(self): 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 + \ " -l " + self.testlen + " -t " + self.testname + " -- -r " + self.reqres_size + \
" &>" + MpExperienceNetperf.NETPERF_LOG " &>" + ExperienceNetperf.NETPERF_LOG
print(s) print(s)
return s return s
def getServerCmd(self): def getServerCmd(self):
s = "sudo " + MpExperienceNetperf.NETSERVER_BIN + " &>" + \ s = "sudo " + ExperienceNetperf.NETSERVER_BIN + " &>" + \
MpExperienceNetperf.NETSERVER_LOG + "&" ExperienceNetperf.NETSERVER_LOG + "&"
print(s) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
#todo use cst #todo use cst
#self.mpTopo.commandTo(self.mpConfig.server, "killall netcat") #self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")

View File

@ -1,16 +1,15 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
class MpExperienceNone(MpExperience): class ExperienceNone(Experience):
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
MpExperience.classicRun(self) Experience.classicRun(self)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
def run(self): def run(self):
self.mpTopo.getCLI() self.mpTopo.getCLI()

View File

@ -1,23 +1,22 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
class MpExperiencePing(MpExperience): class ExperiencePing(Experience):
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
MpExperience.classicRun(self) Experience.classicRun(self)
def prepapre(self): def prepapre(self):
MpExperience.prepare(self) Experience.prepare(self)
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
def run(self): def run(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperiencePing.PING_OUTPUT ) ExperiencePing.PING_OUTPUT )
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -25,6 +24,6 @@ class MpExperiencePing(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperiencePing.PING_OUTPUT " >> " + ExperiencePing.PING_OUTPUT
print(s) print(s)
return s return s

View File

@ -1,10 +1,9 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpMultiInterfaceCongConfig import MpMultiInterfaceCongConfig from mpMultiInterfaceCongConfig import MpMultiInterfaceCongConfig
from mpParamXp import MpParamXp
import os import os
class MpExperienceQUIC(MpExperience): class ExperienceQUIC(Experience):
GO_BIN = "/usr/local/go/bin/go" GO_BIN = "/usr/local/go/bin/go"
WGET = "~/git/wget/src/wget" WGET = "~/git/wget/src/wget"
SERVER_LOG = "quic_server.log" SERVER_LOG = "quic_server.log"
@ -15,15 +14,15 @@ class MpExperienceQUIC(MpExperience):
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceQUIC.PING_OUTPUT ) ExperienceQUIC.PING_OUTPUT )
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -31,7 +30,7 @@ class MpExperienceQUIC(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceQUIC.PING_OUTPUT " >> " + ExperienceQUIC.PING_OUTPUT
print(s) print(s)
return s return s
@ -39,33 +38,33 @@ class MpExperienceQUIC(MpExperience):
""" """
todo : param LD_PRELOAD ?? todo : param LD_PRELOAD ??
""" """
self.file = self.xpParam.getParam(MpParamXp.HTTPSFILE) self.file = self.xpParam.getParam(ExperienceParameter.HTTPSFILE)
self.random_size = self.xpParam.getParam(MpParamXp.HTTPSRANDOMSIZE) self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPSRANDOMSIZE)
self.multipath = self.xpParam.getParam(MpParamXp.QUICMULTIPATH) self.multipath = self.xpParam.getParam(ExperienceParameter.QUICMULTIPATH)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceQUIC.CLIENT_LOG ) ExperienceQUIC.CLIENT_LOG )
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceQUIC.SERVER_LOG ) ExperienceQUIC.SERVER_LOG )
if self.file == "random": if self.file == "random":
self.mpTopo.commandTo(self.mpConfig.client, self.mpTopo.commandTo(self.mpConfig.client,
"dd if=/dev/urandom of=random bs=1K count=" + \ "dd if=/dev/urandom of=random bs=1K count=" + \
self.random_size) self.random_size)
def getQUICServerCmd(self): def getQUICServerCmd(self):
s = MpExperienceQUIC.GO_BIN + " run " + MpExperienceQUIC.SERVER_GO_FILE s = ExperienceQUIC.GO_BIN + " run " + ExperienceQUIC.SERVER_GO_FILE
s += " -www . -certpath " + MpExperienceQUIC.CERTPATH + " &>" s += " -www . -certpath " + ExperienceQUIC.CERTPATH + " &>"
s += MpExperienceQUIC.SERVER_LOG + " &" s += ExperienceQUIC.SERVER_LOG + " &"
print(s) print(s)
return s return s
def getQUICClientCmd(self): 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: if int(self.multipath) > 0:
s += " -m" s += " -m"
s += " https://" + self.mpConfig.getServerIP() + ":6121/random &>" + MpExperienceQUIC.CLIENT_LOG s += " https://" + self.mpConfig.getServerIP() + ":6121/random &>" + ExperienceQUIC.CLIENT_LOG
print(s) print(s)
return s return s
@ -76,13 +75,13 @@ class MpExperienceQUIC(MpExperience):
return s return s
def getCongClientCmd(self, congID): 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 &" "/" + self.file + " --no-check-certificate --disable-mptcp) &> https_client" + str(congID) + ".log &"
print(s) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
if self.file == "random": if self.file == "random":
self.mpTopo.commandTo(self.mpConfig.client, "rm random*") self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
#todo use cst #todo use cst
@ -121,7 +120,7 @@ class MpExperienceQUIC(MpExperience):
for cc in self.mpConfig.cong_clients: for cc in self.mpConfig.cong_clients:
self.mpTopo.commandTo(cc, "while pkill -f wget -0; do sleep 0.5; done") 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): if isinstance(self.mpConfig, MpMultiInterfaceCongConfig):
for cs in self.mpConfig.cong_servers: for cs in self.mpConfig.cong_servers:
self.mpTopo.commandTo(cs, "pkill -f https.py") self.mpTopo.commandTo(cs, "pkill -f https.py")

View File

@ -1,9 +1,8 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
import os import os
class MpExperienceQUICSiri(MpExperience): class ExperienceQUICSiri(Experience):
GO_BIN = "/usr/local/go/bin/go" GO_BIN = "/usr/local/go/bin/go"
SERVER_LOG = "quic_server.log" SERVER_LOG = "quic_server.log"
CLIENT_LOG = "quic_client.log" CLIENT_LOG = "quic_client.log"
@ -12,15 +11,15 @@ class MpExperienceQUICSiri(MpExperience):
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceQUICSiri.PING_OUTPUT ) ExperienceQUICSiri.PING_OUTPUT )
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -28,7 +27,7 @@ class MpExperienceQUICSiri(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceQUICSiri.PING_OUTPUT " >> " + ExperienceQUICSiri.PING_OUTPUT
print(s) print(s)
return s return s
@ -36,33 +35,33 @@ class MpExperienceQUICSiri(MpExperience):
""" """
todo : param LD_PRELOAD ?? todo : param LD_PRELOAD ??
""" """
self.run_time = self.xpParam.getParam(MpParamXp.QUICSIRIRUNTIME) self.run_time = self.xpParam.getParam(ExperienceParameter.QUICSIRIRUNTIME)
self.multipath = self.xpParam.getParam(MpParamXp.QUICMULTIPATH) self.multipath = self.xpParam.getParam(ExperienceParameter.QUICMULTIPATH)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceQUICSiri.CLIENT_LOG ) ExperienceQUICSiri.CLIENT_LOG )
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceQUICSiri.SERVER_LOG ) ExperienceQUICSiri.SERVER_LOG )
def getQUICSiriServerCmd(self): def getQUICSiriServerCmd(self):
s = MpExperienceQUICSiri.GO_BIN + " run " + MpExperienceQUICSiri.SERVER_GO_FILE s = ExperienceQUICSiri.GO_BIN + " run " + ExperienceQUICSiri.SERVER_GO_FILE
s += " -addr 0.0.0.0:8080 &>" + MpExperienceQUICSiri.SERVER_LOG + " &" s += " -addr 0.0.0.0:8080 &>" + ExperienceQUICSiri.SERVER_LOG + " &"
print(s) print(s)
return s return s
def getQUICSiriClientCmd(self): 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" s += " -addr " + self.mpConfig.getServerIP() + ":8080 -runTime " + self.run_time + "s"
if int(self.multipath) > 0: if int(self.multipath) > 0:
s += " -m" s += " -m"
s += " &>" + MpExperienceQUICSiri.CLIENT_LOG s += " &>" + ExperienceQUICSiri.CLIENT_LOG
print(s) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
def run(self): def run(self):
@ -76,7 +75,7 @@ class MpExperienceQUICSiri(MpExperience):
self.mpTopo.commandTo(self.mpConfig.client, cmd) self.mpTopo.commandTo(self.mpConfig.client, cmd)
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after") 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.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") 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 # 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*") self.mpTopo.commandTo(self.mpConfig.client, "rm -r /tmp/go-build*")

View File

@ -1,24 +1,23 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
from mpPvAt import MpPvAt from mpPvAt import MpPvAt
import os import os
class MpExperienceSendFile(MpExperience): class ExperienceSendFile(Experience):
SERVER_LOG = "sendfile_server.log" SERVER_LOG = "sendfile_server.log"
CLIENT_LOG = "sendfile_client.log" CLIENT_LOG = "sendfile_client.log"
WGET_BIN = "./client" WGET_BIN = "./client"
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceSendFile.PING_OUTPUT ) ExperienceSendFile.PING_OUTPUT )
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -26,7 +25,7 @@ class MpExperienceSendFile(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceSendFile.PING_OUTPUT " >> " + ExperienceSendFile.PING_OUTPUT
print(s) print(s)
return s return s
@ -34,32 +33,32 @@ class MpExperienceSendFile(MpExperience):
""" """
todo : param LD_PRELOAD ?? todo : param LD_PRELOAD ??
""" """
self.file = self.xpParam.getParam(MpParamXp.HTTPSFILE) self.file = self.xpParam.getParam(ExperienceParameter.HTTPSFILE)
self.random_size = self.xpParam.getParam(MpParamXp.HTTPSRANDOMSIZE) self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPSRANDOMSIZE)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceSendFile.CLIENT_LOG ) ExperienceSendFile.CLIENT_LOG )
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceSendFile.SERVER_LOG ) ExperienceSendFile.SERVER_LOG )
if self.file == "random": if self.file == "random":
self.mpTopo.commandTo(self.mpConfig.client, self.mpTopo.commandTo(self.mpConfig.client,
"dd if=/dev/urandom of=random bs=1K count=" + \ "dd if=/dev/urandom of=random bs=1K count=" + \
self.random_size) self.random_size)
def getSendFileServerCmd(self): def getSendFileServerCmd(self):
s = "./server &>" + MpExperienceSendFile.SERVER_LOG + "&" s = "./server &>" + ExperienceSendFile.SERVER_LOG + "&"
print(s) print(s)
return s return s
def getSendFileClientCmd(self): 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) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
if self.file == "random": if self.file == "random":
self.mpTopo.commandTo(self.mpConfig.client, "rm random*") self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
#todo use cst #todo use cst

View File

@ -1,9 +1,8 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
from mpPvAt import MpPvAt from mpPvAt import MpPvAt
import os import os
class MpExperienceSiri(MpExperience): class ExperienceSiri(Experience):
SERVER_LOG = "siri_server.log" SERVER_LOG = "siri_server.log"
CLIENT_LOG = "siri_client.log" CLIENT_LOG = "siri_client.log"
CLIENT_ERR = "siri_client.err" CLIENT_ERR = "siri_client.err"
@ -11,15 +10,15 @@ class MpExperienceSiri(MpExperience):
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceSiri.PING_OUTPUT ) ExperienceSiri.PING_OUTPUT )
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -27,7 +26,7 @@ class MpExperienceSiri(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceSiri.PING_OUTPUT " >> " + ExperienceSiri.PING_OUTPUT
print(s) print(s)
return s return s
@ -35,41 +34,41 @@ class MpExperienceSiri(MpExperience):
""" """
todo : param LD_PRELOAD ?? todo : param LD_PRELOAD ??
""" """
self.run_time = self.xpParam.getParam(MpParamXp.SIRIRUNTIME) self.run_time = self.xpParam.getParam(ExperienceParameter.SIRIRUNTIME)
self.query_size = self.xpParam.getParam(MpParamXp.SIRIQUERYSIZE) self.query_size = self.xpParam.getParam(ExperienceParameter.SIRIQUERYSIZE)
self.response_size = self.xpParam.getParam(MpParamXp.SIRIRESPONSESIZE) self.response_size = self.xpParam.getParam(ExperienceParameter.SIRIRESPONSESIZE)
self.delay_query_response = self.xpParam.getParam(MpParamXp.SIRIDELAYQUERYRESPONSE) self.delay_query_response = self.xpParam.getParam(ExperienceParameter.SIRIDELAYQUERYRESPONSE)
self.min_payload_size = self.xpParam.getParam(MpParamXp.SIRIMINPAYLOADSIZE) self.min_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMINPAYLOADSIZE)
self.max_payload_size = self.xpParam.getParam(MpParamXp.SIRIMAXPAYLOADSIZE) self.max_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMAXPAYLOADSIZE)
self.interval_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALTIMEMS) self.interval_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALTIMEMS)
self.buffer_size = self.xpParam.getParam(MpParamXp.SIRIBUFFERSIZE) self.buffer_size = self.xpParam.getParam(ExperienceParameter.SIRIBUFFERSIZE)
self.burst_size = self.xpParam.getParam(MpParamXp.SIRIBURSTSIZE) self.burst_size = self.xpParam.getParam(ExperienceParameter.SIRIBURSTSIZE)
self.interval_burst_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALBURSTTIMEMS) self.interval_burst_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALBURSTTIMEMS)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceSiri.CLIENT_LOG) ExperienceSiri.CLIENT_LOG)
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceSiri.SERVER_LOG) ExperienceSiri.SERVER_LOG)
def getSiriServerCmd(self): def getSiriServerCmd(self):
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \ s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
"/siri_server.py &>" + MpExperienceSiri.SERVER_LOG + "&" "/siri_server.py &>" + ExperienceSiri.SERVER_LOG + "&"
print(s) print(s)
return s return s
def getSiriClientCmd(self): 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.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
" " + self.delay_query_response + " " + self.min_payload_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 + \ 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) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
def run(self): def run(self):

View File

@ -1,9 +1,8 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
from mpPvAt import MpPvAt from mpPvAt import MpPvAt
import os import os
class MpExperienceSiriHTTP(MpExperience): class ExperienceSiriHTTP(Experience):
HTTP_SERVER_LOG = "http_server.log" HTTP_SERVER_LOG = "http_server.log"
HTTP_CLIENT_LOG = "http_client.log" HTTP_CLIENT_LOG = "http_client.log"
WGET_BIN = "wget" WGET_BIN = "wget"
@ -14,15 +13,15 @@ class MpExperienceSiriHTTP(MpExperience):
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceSiriHTTP.PING_OUTPUT ) ExperienceSiriHTTP.PING_OUTPUT )
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -30,7 +29,7 @@ class MpExperienceSiriHTTP(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceSiriHTTP.PING_OUTPUT " >> " + ExperienceSiriHTTP.PING_OUTPUT
print(s) print(s)
return s return s
@ -38,29 +37,29 @@ class MpExperienceSiriHTTP(MpExperience):
""" """
todo : param LD_PRELOAD ?? todo : param LD_PRELOAD ??
""" """
self.run_time = self.xpParam.getParam(MpParamXp.SIRIRUNTIME) self.run_time = self.xpParam.getParam(ExperienceParameter.SIRIRUNTIME)
self.query_size = self.xpParam.getParam(MpParamXp.SIRIQUERYSIZE) self.query_size = self.xpParam.getParam(ExperienceParameter.SIRIQUERYSIZE)
self.response_size = self.xpParam.getParam(MpParamXp.SIRIRESPONSESIZE) self.response_size = self.xpParam.getParam(ExperienceParameter.SIRIRESPONSESIZE)
self.delay_query_response = self.xpParam.getParam(MpParamXp.SIRIDELAYQUERYRESPONSE) self.delay_query_response = self.xpParam.getParam(ExperienceParameter.SIRIDELAYQUERYRESPONSE)
self.min_payload_size = self.xpParam.getParam(MpParamXp.SIRIMINPAYLOADSIZE) self.min_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMINPAYLOADSIZE)
self.max_payload_size = self.xpParam.getParam(MpParamXp.SIRIMAXPAYLOADSIZE) self.max_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMAXPAYLOADSIZE)
self.interval_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALTIMEMS) self.interval_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALTIMEMS)
self.buffer_size = self.xpParam.getParam(MpParamXp.SIRIBUFFERSIZE) self.buffer_size = self.xpParam.getParam(ExperienceParameter.SIRIBUFFERSIZE)
self.burst_size = self.xpParam.getParam(MpParamXp.SIRIBURSTSIZE) self.burst_size = self.xpParam.getParam(ExperienceParameter.SIRIBURSTSIZE)
self.interval_burst_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALBURSTTIMEMS) self.interval_burst_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALBURSTTIMEMS)
self.file = self.xpParam.getParam(MpParamXp.HTTPFILE) self.file = self.xpParam.getParam(ExperienceParameter.HTTPFILE)
self.random_size = self.xpParam.getParam(MpParamXp.HTTPRANDOMSIZE) self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPRANDOMSIZE)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceSiriHTTP.CLIENT_LOG) ExperienceSiriHTTP.CLIENT_LOG)
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceSiriHTTP.SERVER_LOG) ExperienceSiriHTTP.SERVER_LOG)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceSiriHTTP.HTTP_CLIENT_LOG) ExperienceSiriHTTP.HTTP_CLIENT_LOG)
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceSiriHTTP.HTTP_SERVER_LOG) ExperienceSiriHTTP.HTTP_SERVER_LOG)
if self.file == "random": if self.file == "random":
self.mpTopo.commandTo(self.mpConfig.client, self.mpTopo.commandTo(self.mpConfig.client,
"dd if=/dev/urandom of=random bs=1K count=" + \ "dd if=/dev/urandom of=random bs=1K count=" + \
@ -69,32 +68,32 @@ class MpExperienceSiriHTTP(MpExperience):
def getSiriServerCmd(self): def getSiriServerCmd(self):
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \ s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
"/siri_server.py &>" + MpExperienceSiriHTTP.SERVER_LOG + "&" "/siri_server.py &>" + ExperienceSiriHTTP.SERVER_LOG + "&"
print(s) print(s)
return s return s
def getSiriClientCmd(self): 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.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
" " + self.delay_query_response + " " + self.min_payload_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 + \ 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) print(s)
return s return s
def getHTTPServerCmd(self): def getHTTPServerCmd(self):
s = "/etc/init.d/apache2 restart &>" + MpExperienceSiriHTTP.SERVER_LOG + "&" s = "/etc/init.d/apache2 restart &>" + ExperienceSiriHTTP.SERVER_LOG + "&"
print(s) print(s)
return s return s
def getHTTPClientCmd(self): def getHTTPClientCmd(self):
s = MpExperienceSiriHTTP.WGET_BIN + " http://" + self.mpConfig.getServerIP() + \ s = ExperienceSiriHTTP.WGET_BIN + " http://" + self.mpConfig.getServerIP() + \
"/" + self.file + " --no-check-certificate" "/" + self.file + " --no-check-certificate"
print(s) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
if self.file == "random": if self.file == "random":
self.mpTopo.commandTo(self.mpConfig.client, "rm random*") self.mpTopo.commandTo(self.mpConfig.client, "rm random*")

View File

@ -1,9 +1,8 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
from mpPvAt import MpPvAt from mpPvAt import MpPvAt
import os import os
class MpExperienceSiriMsg(MpExperience): class ExperienceSiriMsg(Experience):
MSG_SERVER_LOG = "msg_server.log" MSG_SERVER_LOG = "msg_server.log"
MSG_CLIENT_LOG = "msg_client.log" MSG_CLIENT_LOG = "msg_client.log"
MSG_CLIENT_ERR = "msg_client.err" MSG_CLIENT_ERR = "msg_client.err"
@ -14,14 +13,14 @@ class MpExperienceSiriMsg(MpExperience):
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceSiriMsg.PING_OUTPUT ) ExperienceSiriMsg.PING_OUTPUT )
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
@ -30,7 +29,7 @@ class MpExperienceSiriMsg(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceSiriMsg.PING_OUTPUT " >> " + ExperienceSiriMsg.PING_OUTPUT
print(s) print(s)
return s return s
@ -53,50 +52,50 @@ class MpExperienceSiriMsg(MpExperience):
self.nb_requests = self.xpParam.getParam(MpParamXp.MSGNBREQUESTS) self.nb_requests = self.xpParam.getParam(MpParamXp.MSGNBREQUESTS)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceSiriMsg.CLIENT_LOG) ExperienceSiriMsg.CLIENT_LOG)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceSiriMsg.CLIENT_ERR) ExperienceSiriMsg.CLIENT_ERR)
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceSiriMsg.SERVER_LOG) ExperienceSiriMsg.SERVER_LOG)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceSiriMsg.MSG_CLIENT_LOG) ExperienceSiriMsg.MSG_CLIENT_LOG)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceSiriMsg.MSG_CLIENT_ERR) ExperienceSiriMsg.MSG_CLIENT_ERR)
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceSiriMsg.MSG_SERVER_LOG) ExperienceSiriMsg.MSG_SERVER_LOG)
def getSiriServerCmd(self): def getSiriServerCmd(self):
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \ s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
"/siri_server.py &>" + MpExperienceSiriMsg.SERVER_LOG + "&" "/siri_server.py &>" + ExperienceSiriMsg.SERVER_LOG + "&"
print(s) print(s)
return s return s
def getSiriClientCmd(self): 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.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
" " + self.delay_query_response + " " + self.min_payload_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 + \ 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) print(s)
return s return s
def getMsgServerCmd(self): def getMsgServerCmd(self):
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \ 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) print(s)
return s return s
def getMsgClientCmd(self): def getMsgClientCmd(self):
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \ s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
"/msg_client.py --sleep " + self.client_sleep + " --nb " + self.nb_requests + \ "/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) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
def run(self): def run(self):

View File

@ -1,24 +1,23 @@
from mpExperience import MpExperience from core.experience import Experience, ExperienceParameter
from mpParamXp import MpParamXp
from mpPvAt import MpPvAt from mpPvAt import MpPvAt
import os import os
class MpExperienceVLC(MpExperience): class ExperienceVLC(Experience):
SERVER_LOG = "vlc_server.log" SERVER_LOG = "vlc_server.log"
CLIENT_LOG = "vlc_client.log" CLIENT_LOG = "vlc_client.log"
VLC_BIN = "/home/mininet/vlc/vlc" VLC_BIN = "/home/mininet/vlc/vlc"
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, xpParamFile, mpTopo, mpConfig): def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam() self.loadParam()
self.ping() self.ping()
MpExperience.classicRun(self) Experience.classicRun(self)
def ping(self): def ping(self):
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceVLC.PING_OUTPUT ) ExperienceVLC.PING_OUTPUT )
count = self.xpParam.getParam(MpParamXp.PINGCOUNT) count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
for i in range(0, self.mpConfig.getClientInterfaceCount()): for i in range(0, self.mpConfig.getClientInterfaceCount()):
cmd = self.pingCommand(self.mpConfig.getClientIP(i), cmd = self.pingCommand(self.mpConfig.getClientIP(i),
self.mpConfig.getServerIP(), n = count) self.mpConfig.getServerIP(), n = count)
@ -26,7 +25,7 @@ class MpExperienceVLC(MpExperience):
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpExperienceVLC.PING_OUTPUT " >> " + ExperienceVLC.PING_OUTPUT
print(s) print(s)
return s return s
@ -34,41 +33,41 @@ class MpExperienceVLC(MpExperience):
""" """
todo : param LD_PRELOAD ?? todo : param LD_PRELOAD ??
""" """
self.file = self.xpParam.getParam(MpParamXp.VLCFILE) self.file = self.xpParam.getParam(ExperienceParameter.VLCFILE)
self.time = self.xpParam.getParam(MpParamXp.VLCTIME) self.time = self.xpParam.getParam(ExperienceParameter.VLCTIME)
# todo # todo
# self.random_size = self.xpParam.getParam(MpParamXp.VLCRANDOMSIZE) # self.random_size = self.xpParam.getParam(ExperienceParameter.VLCRANDOMSIZE)
def prepare(self): def prepare(self):
MpExperience.prepare(self) Experience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ 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.client, "Xvfb :66 &")
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceVLC.SERVER_LOG ) ExperienceVLC.SERVER_LOG )
if self.file == "random": if self.file == "random":
self.mpTopo.commandTo(self.mpConfig.client, self.mpTopo.commandTo(self.mpConfig.client,
"dd if=/dev/urandom of=random bs=1K count=" + \ "dd if=/dev/urandom of=random bs=1K count=" + \
self.random_size) self.random_size)
def getVLCServerCmd(self): def getVLCServerCmd(self):
s = "/etc/init.d/apache2 restart &>" + MpExperienceVLC.SERVER_LOG + " " s = "/etc/init.d/apache2 restart &>" + ExperienceVLC.SERVER_LOG + " "
print(s) print(s)
return s return s
def getVLCClientCmd(self): def getVLCClientCmd(self):
s = "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/mininet/usr/lib/ && sudo ldconfig && " \ 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 " + \ " --adaptive-logic 3 --no-loop --play-and-exit " + \
" http://" + self.mpConfig.getServerIP() + \ " 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" : if self.time != "0" :
s = s + " &" s = s + " &"
print(s) print(s)
return s return s
def clean(self): def clean(self):
MpExperience.clean(self) Experience.clean(self)
if self.file == "random": if self.file == "random":
self.mpTopo.commandTo(self.mpConfig.client, "rm random*") self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
self.mpTopo.commandTo(self.mpConfig.client, "pkill Xvfb") self.mpTopo.commandTo(self.mpConfig.client, "pkill Xvfb")

View File

@ -1,11 +1,9 @@
from mpConfig import MpConfig from core.topo import Topo, TopoConfig, TopoParameter
from mpMultiInterfaceTopo import MpMultiInterfaceTopo from mpMultiInterfaceTopo import MpMultiInterfaceTopo
from mpParamTopo import MpParamTopo
from mpTopo import MpTopo
class MpMultiInterfaceConfig(MpConfig): class MpMultiInterfaceConfig(TopoConfig):
def __init__(self, topo, param): def __init__(self, topo, param):
MpConfig.__init__(self, topo, param) super().__init__(topo, param)
def configureRoute(self): def configureRoute(self):
i = 0 i = 0
@ -33,9 +31,9 @@ class MpMultiInterfaceConfig(MpConfig):
def configureInterfaces(self): def configureInterfaces(self):
print("Configure interfaces for multi inf") print("Configure interfaces for multi inf")
self.client = self.topo.getHost(MpTopo.clientName) self.client = self.topo.getHost(Topo.clientName)
self.server = self.topo.getHost(MpTopo.serverName) self.server = self.topo.getHost(Topo.serverName)
self.router = self.topo.getHost(MpTopo.routerName) self.router = self.topo.getHost(Topo.routerName)
i = 0 i = 0
netmask = "255.255.255.0" netmask = "255.255.255.0"
links = self.topo.getLinkCharacteristics() links = self.topo.getLinkCharacteristics()
@ -78,27 +76,27 @@ class MpMultiInterfaceConfig(MpConfig):
self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac) self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac)
def getClientIP(self, interfaceID): def getClientIP(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
clientIP = lSubnet + str(interfaceID) + ".1" clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP return clientIP
def getClientSubnet(self, interfaceID): def getClientSubnet(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
clientSubnet = lSubnet + str(interfaceID) + ".0/24" clientSubnet = lSubnet + str(interfaceID) + ".0/24"
return clientSubnet return clientSubnet
def getRouterIPSwitch(self, interfaceID): def getRouterIPSwitch(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
routerIP = lSubnet + str(interfaceID) + ".2" routerIP = lSubnet + str(interfaceID) + ".2"
return routerIP return routerIP
def getRouterIPServer(self): def getRouterIPServer(self):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(TopoParameter.RSUBNET)
routerIP = rSubnet + "0.2" routerIP = rSubnet + "0.2"
return routerIP return routerIP
def getServerIP(self): def getServerIP(self):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(TopoParameter.RSUBNET)
serverIP = rSubnet + "0.1" serverIP = rSubnet + "0.1"
return serverIP return serverIP
@ -109,19 +107,19 @@ class MpMultiInterfaceConfig(MpConfig):
return self.getRouterInterfaceSwitch(len(self.topo.switchServer)) return self.getRouterInterfaceSwitch(len(self.topo.switchServer))
def getClientInterface(self, interfaceID): def getClientInterface(self, interfaceID):
return MpTopo.clientName + "-eth" + str(interfaceID) return Topo.clientName + "-eth" + str(interfaceID)
def getRouterInterfaceSwitch(self, interfaceID): def getRouterInterfaceSwitch(self, interfaceID):
return MpTopo.routerName + "-eth" + str(interfaceID) return Topo.routerName + "-eth" + str(interfaceID)
def getServerInterface(self): def getServerInterface(self):
return MpTopo.serverName + "-eth0" return Topo.serverName + "-eth0"
def getSwitchClientName(self, id): def getSwitchClientName(self, id):
return MpTopo.switchNamePrefix + str(2 * id) return Topo.switchNamePrefix + str(2 * id)
def getSwitchServerName(self, id): def getSwitchServerName(self, id):
return MpTopo.switchNamePrefix + str(2 * id + 1) return Topo.switchNamePrefix + str(2 * id + 1)
def getMidLeftName(self, id): def getMidLeftName(self, id):
return self.getSwitchClientName(id) return self.getSwitchClientName(id)

View File

@ -1,11 +1,9 @@
from mpConfig import MpConfig
from mpMultiInterfaceCongTopo import MpMultiInterfaceCongTopo from mpMultiInterfaceCongTopo import MpMultiInterfaceCongTopo
from mpParamTopo import MpParamTopo from core.topo import TopoConfig, Topo, TopoParameter
from mpTopo import MpTopo
class MpMultiInterfaceCongConfig(MpConfig): class MpMultiInterfaceCongConfig(TopoConfig):
def __init__(self, topo, param): def __init__(self, topo, param):
MpConfig.__init__(self, topo, param) super().__init__(topo, param)
def configureRoute(self): def configureRoute(self):
i = 0 i = 0
@ -65,9 +63,9 @@ class MpMultiInterfaceCongConfig(MpConfig):
def configureInterfaces(self): def configureInterfaces(self):
print("Configure interfaces for multi inf") print("Configure interfaces for multi inf")
self.client = self.topo.getHost(MpTopo.clientName) self.client = self.topo.getHost(Topo.clientName)
self.server = self.topo.getHost(MpTopo.serverName) self.server = self.topo.getHost(Topo.serverName)
self.router = self.topo.getHost(MpTopo.routerName) self.router = self.topo.getHost(Topo.routerName)
cong_client_names = self.topo.getCongClients() cong_client_names = self.topo.getCongClients()
self.cong_clients = [] self.cong_clients = []
for cn in cong_client_names: for cn in cong_client_names:
@ -142,42 +140,42 @@ class MpMultiInterfaceCongConfig(MpConfig):
i = i + 1 i = i + 1
def getClientIP(self, interfaceID): def getClientIP(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
clientIP = lSubnet + str(interfaceID) + ".1" clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP return clientIP
def getCongClientIP(self, interfaceID): def getCongClientIP(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
congClientIP = lSubnet + str(interfaceID) + ".127" congClientIP = lSubnet + str(interfaceID) + ".127"
return congClientIP return congClientIP
def getClientSubnet(self, interfaceID): def getClientSubnet(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
clientSubnet = lSubnet + str(interfaceID) + ".0/24" clientSubnet = lSubnet + str(interfaceID) + ".0/24"
return clientSubnet return clientSubnet
def getRouterIPSwitch(self, interfaceID): def getRouterIPSwitch(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
routerIP = lSubnet + str(interfaceID) + ".2" routerIP = lSubnet + str(interfaceID) + ".2"
return routerIP return routerIP
def getRouterIPServer(self): def getRouterIPServer(self):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(TopoParameter.RSUBNET)
routerIP = rSubnet + "0.2" routerIP = rSubnet + "0.2"
return routerIP return routerIP
def getRouterIPCongServer(self, congID): def getRouterIPCongServer(self, congID):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(TopoParameter.RSUBNET)
routerIP = rSubnet + str(1 + congID) + ".2" routerIP = rSubnet + str(1 + congID) + ".2"
return routerIP return routerIP
def getServerIP(self): def getServerIP(self):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(TopoParameter.RSUBNET)
serverIP = rSubnet + "0.1" serverIP = rSubnet + "0.1"
return serverIP return serverIP
def getCongServerIP(self, congID): def getCongServerIP(self, congID):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(TopoParameter.RSUBNET)
serverIP = rSubnet + str(1 + congID) + ".1" serverIP = rSubnet + str(1 + congID) + ".1"
return serverIP return serverIP
@ -191,25 +189,25 @@ class MpMultiInterfaceCongConfig(MpConfig):
return self.getRouterInterfaceSwitch(len(self.topo.switch) + 1 + congID) return self.getRouterInterfaceSwitch(len(self.topo.switch) + 1 + congID)
def getClientInterface(self, interfaceID): def getClientInterface(self, interfaceID):
return MpTopo.clientName + "-eth" + str(interfaceID) return Topo.clientName + "-eth" + str(interfaceID)
def getCongClientInterface(self, interfaceID): def getCongClientInterface(self, interfaceID):
return MpMultiInterfaceCongTopo.congClientName + str(interfaceID) + "-eth0" return MpMultiInterfaceCongTopo.congClientName + str(interfaceID) + "-eth0"
def getRouterInterfaceSwitch(self, interfaceID): def getRouterInterfaceSwitch(self, interfaceID):
return MpTopo.routerName + "-eth" + str(interfaceID) return Topo.routerName + "-eth" + str(interfaceID)
def getServerInterface(self): def getServerInterface(self):
return MpTopo.serverName + "-eth0" return Topo.serverName + "-eth0"
def getCongServerInterface(self, interfaceID): def getCongServerInterface(self, interfaceID):
return MpMultiInterfaceCongTopo.congServerName + str(interfaceID) + "-eth0" return MpMultiInterfaceCongTopo.congServerName + str(interfaceID) + "-eth0"
def getMidLeftName(self, id): def getMidLeftName(self, id):
return MpTopo.switchNamePrefix + str(id) return Topo.switchNamePrefix + str(id)
def getMidRightName(self, id): def getMidRightName(self, id):
return MpTopo.routerName return Topo.routerName
def getMidL2RInterface(self, id): def getMidL2RInterface(self, id):
return self.getMidLeftName(id) + "-eth2" return self.getMidLeftName(id) + "-eth2"

View File

@ -1,15 +1,15 @@
from mpTopo import MpTopo from core.topo import Topo
class MpMultiInterfaceCongTopo(MpTopo): class MpMultiInterfaceCongTopo(Topo):
congClientName = "CCli" congClientName = "CCli"
congServerName = "CSer" congServerName = "CSer"
def __init__(self, topoBuilder, parameterFile): def __init__(self, topoBuilder, parameterFile):
MpTopo.__init__(self,topoBuilder, parameterFile) super().__init__(topoBuilder, parameterFile)
print("Hello from topo multi if") print("Hello from topo multi if")
self.client = self.addHost(MpTopo.clientName) self.client = self.addHost(Topo.clientName)
self.server = self.addHost(MpTopo.serverName) self.server = self.addHost(Topo.serverName)
self.router = self.addHost(MpTopo.routerName) self.router = self.addHost(Topo.routerName)
self.cong_clients = [] self.cong_clients = []
self.cong_servers = [] self.cong_servers = []
self.switch = [] self.switch = []

View File

@ -1,12 +1,12 @@
from mpTopo import MpTopo from core.topo import Topo
class MpMultiInterfaceTopo(MpTopo): class MpMultiInterfaceTopo(Topo):
def __init__(self, topoBuilder, parameterFile): def __init__(self, topoBuilder, parameterFile):
MpTopo.__init__(self,topoBuilder, parameterFile) super().__init__(topoBuilder, parameterFile)
print("Hello from topo multi if") print("Hello from topo multi if")
self.client = self.addHost(MpTopo.clientName) self.client = self.addHost(Topo.clientName)
self.server = self.addHost(MpTopo.serverName) self.server = self.addHost(Topo.serverName)
self.router = self.addHost(MpTopo.routerName) self.router = self.addHost(Topo.routerName)
self.switchClient = [] self.switchClient = []
self.switchServer = [] self.switchServer = []
for l in self.topoParam.linkCharacteristics: for l in self.topoParam.linkCharacteristics:

View File

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

View File

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

View File

@ -2,7 +2,7 @@
import sys, getopt import sys, getopt
from mpXpRunner import MpXpRunner from mpXpRunner import MpXpRunner
from mpTopo import MpTopo from core.topo import Topo
topoParamFile = None topoParamFile = None
xpParamFile = None xpParamFile = None
@ -35,4 +35,4 @@ def parseArgs(argv):
if __name__ == '__main__': if __name__ == '__main__':
parseArgs(sys.argv[1:]) parseArgs(sys.argv[1:])
MpXpRunner(MpTopo.mininetBuilder, topoParamFile, xpParamFile) MpXpRunner(Topo.mininetBuilder, topoParamFile, xpParamFile)

View File

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

View File

@ -1,18 +1,15 @@
from mpConfig import MpConfig from core.topo import Topo, TopoConfig, TopoParameter
from mpTwoInterfaceCongestionTopo import MpTwoInterfaceCongestionTopo from mpTwoInterfaceCongestionTopo import MpTwoInterfaceCongestionTopo
from mpParamTopo import MpParamTopo
from mpTopo import MpTopo
class MpTwoInterfaceCongestionConfig(TopoConfig):
class MpTwoInterfaceCongestionConfig(MpConfig):
def __init__(self, topo, param): def __init__(self, topo, param):
MpConfig.__init__(self, topo, param) super().__init__(topo, param)
def configureRoute(self): def configureRoute(self):
# Client - Router # Client - Router
cmd = self.addRouteTableCommand("10.0.0.1", 0) cmd = self.addRouteTableCommand("10.0.0.1", 0)
self.topo.commandTo(self.client, cmd) 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) self.topo.commandTo(self.client, cmd)
cmd = self.addRouteDefaultCommand("10.0.0.2", 0) cmd = self.addRouteDefaultCommand("10.0.0.2", 0)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
@ -20,7 +17,7 @@ class MpTwoInterfaceCongestionConfig(MpConfig):
# Client -> Router cong # Client -> Router cong
cmd = self.addRouteTableCommand("10.0.1.1", 1) cmd = self.addRouteTableCommand("10.0.1.1", 1)
self.topo.commandTo(self.client, cmd) 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) self.topo.commandTo(self.client, cmd)
cmd = self.addRouteDefaultCommand("10.0.1.2", 1) cmd = self.addRouteDefaultCommand("10.0.1.2", 1)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
@ -28,7 +25,7 @@ class MpTwoInterfaceCongestionConfig(MpConfig):
# Client cong -> Router cong # Client cong -> Router cong
cmd = self.addRouteTableCommand("10.0.2.1", 0) cmd = self.addRouteTableCommand("10.0.2.1", 0)
self.topo.commandTo(self.clientCong, cmd) 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) self.topo.commandTo(self.clientCong, cmd)
cmd = self.addRouteDefaultCommand("10.0.2.2", 0) cmd = self.addRouteDefaultCommand("10.0.2.2", 0)
self.topo.commandTo(self.clientCong, cmd) self.topo.commandTo(self.clientCong, cmd)
@ -36,7 +33,7 @@ class MpTwoInterfaceCongestionConfig(MpConfig):
# Router cong -> Router # Router cong -> Router
cmd = self.addRouteTableCommand("10.0.3.1", 0) cmd = self.addRouteTableCommand("10.0.3.1", 0)
self.topo.commandTo(self.routerCong, cmd) 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) self.topo.commandTo(self.routerCong, cmd)
cmd = self.addRouteDefaultCommand("10.0.3.2", 0) cmd = self.addRouteDefaultCommand("10.0.3.2", 0)
self.topo.commandTo(self.routerCong, cmd) self.topo.commandTo(self.routerCong, cmd)
@ -44,33 +41,33 @@ class MpTwoInterfaceCongestionConfig(MpConfig):
# Router -> Router cong # Router -> Router cong
cmd = self.addRouteTableCommand("10.0.3.2", 0) cmd = self.addRouteTableCommand("10.0.3.2", 0)
self.topo.commandTo(self.router, cmd) 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) self.topo.commandTo(self.router, cmd)
cmd = self.addRouteDefaultCommand("10.0.3.1", 0) cmd = self.addRouteDefaultCommand("10.0.3.1", 0)
self.topo.commandTo(self.router, cmd) self.topo.commandTo(self.router, cmd)
# Default route Client # 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) self.topo.commandTo(self.client, cmd)
# Default route Client cong # 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) self.topo.commandTo(self.clientCong, cmd)
# Default route Router cong # 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) self.topo.commandTo(self.routerCong, cmd)
# Default route Router # 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) self.topo.commandTo(self.router, cmd)
# Default route Server # 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) self.topo.commandTo(self.server, cmd)
# Default route Server cong # 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) self.topo.commandTo(self.serverCong, cmd)
def configureInterface(self, srcHost, dstHost, srcInterfaceName, srcIP, netmask): def configureInterface(self, srcHost, dstHost, srcInterfaceName, srcIP, netmask):
@ -82,84 +79,84 @@ class MpTwoInterfaceCongestionConfig(MpConfig):
def configureInterfaces(self): def configureInterfaces(self):
print("Configure interfaces for two inf cong") print("Configure interfaces for two inf cong")
self.client = self.topo.getHost(MpTopo.clientName) self.client = self.topo.getHost(Topo.clientName)
self.clientCong = self.topo.getHost(MpTopo.clientName + "Cong") self.clientCong = self.topo.getHost(Topo.clientName + "Cong")
self.server = self.topo.getHost(MpTopo.serverName) self.server = self.topo.getHost(Topo.serverName)
self.serverCong = self.topo.getHost(MpTopo.serverName + "Cong") self.serverCong = self.topo.getHost(Topo.serverName + "Cong")
self.router = self.topo.getHost(MpTopo.routerName) self.router = self.topo.getHost(Topo.routerName)
self.routerCong = self.topo.getHost(MpTopo.routerName + "Cong") self.routerCong = self.topo.getHost(Topo.routerName + "Cong")
netmask = "255.255.255.0" netmask = "255.255.255.0"
links = self.topo.getLinkCharacteristics() links = self.topo.getLinkCharacteristics()
# Link 0: Client - Router # 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): if(links[0].back_up):
cmd = self.interfaceBUPCommand(MpTopo.clientName + "-eth0") cmd = self.interfaceBUPCommand(Topo.clientName + "-eth0")
self.topo.commandTo(self.client, cmd) 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])) print(str(links[0]))
# Client - Router cong # 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): if(links[1].back_up):
cmd = self.interfaceBUPCommand(MpTopo.clientName + "-eth1") cmd = self.interfaceBUPCommand(Topo.clientName + "-eth1")
self.topo.commandTo(self.client, cmd) 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 # Link 1: Router - Router cong
self.configureInterface(self.routerCong, self.router, MpTopo.routerName + "Cong-eth2", "10.0.3.1", netmask) self.configureInterface(self.routerCong, self.router, Topo.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.router, self.routerCong, Topo.routerName + "-eth1", "10.0.3.2", netmask)
print(str(links[1])) print(str(links[1]))
# Link 2: Client cong - Router cong # Link 2: Client cong - Router cong
self.configureInterface(self.clientCong, self.routerCong, MpTopo.clientName + "Cong-eth0", "10.0.2.1", netmask) self.configureInterface(self.clientCong, self.routerCong, Topo.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.routerCong, self.clientCong, Topo.routerName + "Cong-eth1", "10.0.2.2", netmask)
print(str(links[2])) print(str(links[2]))
# Router - Server # Router - Server
self.configureInterface(self.server, self.router, MpTopo.serverName + "-eth0", "10.1.0.1", netmask) self.configureInterface(self.server, self.router, Topo.serverName + "-eth0", "10.1.0.1", netmask)
self.configureInterface(self.router, self.server, MpTopo.routerName + "-eth2", "10.1.0.2", netmask) self.configureInterface(self.router, self.server, Topo.routerName + "-eth2", "10.1.0.2", netmask)
# Router - Server cong # Router - Server cong
self.configureInterface(self.serverCong, self.router, MpTopo.serverName + "Cong-eth0", "10.1.1.1", netmask) self.configureInterface(self.serverCong, self.router, Topo.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.router, self.serverCong, Topo.routerName + "-eth3", "10.1.1.2", netmask)
def getClientIP(self, interfaceID): def getClientIP(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
clientIP = lSubnet + str(interfaceID) + ".1" clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP return clientIP
def getClientSubnet(self, interfaceID): def getClientSubnet(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
clientSubnet = lSubnet + str(interfaceID) + ".0/24" clientSubnet = lSubnet + str(interfaceID) + ".0/24"
return clientSubnet return clientSubnet
def getClientCongIP(self): def getClientCongIP(self):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
clientIP = lSubnet + str(2) + ".1" clientIP = lSubnet + str(2) + ".1"
return clientIP return clientIP
def getClientCongSubnet(self, interfaceID): def getClientCongSubnet(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
clientSubnet = lSubnet + str(128) + ".0/24" clientSubnet = lSubnet + str(128) + ".0/24"
return clientSubnet return clientSubnet
def getRouterIPSwitch(self, interfaceID): def getRouterIPSwitch(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(TopoParameter.LSUBNET)
routerIP = lSubnet + str(interfaceID) + ".2" routerIP = lSubnet + str(interfaceID) + ".2"
return routerIP return routerIP
def getRouterIPServer(self): def getRouterIPServer(self):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(TopoParameter.RSUBNET)
routerIP = rSubnet + "0.2" routerIP = rSubnet + "0.2"
return routerIP return routerIP
def getServerIP(self): def getServerIP(self):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(TopoParameter.RSUBNET)
serverIP = rSubnet + "0.1" serverIP = rSubnet + "0.1"
return serverIP return serverIP
@ -170,22 +167,22 @@ class MpTwoInterfaceCongestionConfig(MpConfig):
return self.getRouterInterfaceSwitch(len(self.topo.switch)) return self.getRouterInterfaceSwitch(len(self.topo.switch))
def getClientInterface(self, interfaceID): def getClientInterface(self, interfaceID):
return MpTopo.clientName + "-eth" + str(interfaceID) return Topo.clientName + "-eth" + str(interfaceID)
def getRouterInterfaceSwitch(self, interfaceID): def getRouterInterfaceSwitch(self, interfaceID):
return MpTopo.routerName + "-eth" + str(interfaceID) return Topo.routerName + "-eth" + str(interfaceID)
def getServerInterface(self): def getServerInterface(self):
return MpTopo.serverName + "-eth0" return Topo.serverName + "-eth0"
def getMidLeftName(self, id): def getMidLeftName(self, id):
return MpTopo.switchNamePrefix + str(id) return Topo.switchNamePrefix + str(id)
def getMidRightName(self, id): def getMidRightName(self, id):
if id == 2: if id == 2:
return MpTopo.routerName + "Cong" return Topo.routerName + "Cong"
return MpTopo.routerName return Topo.routerName
def getMidL2RInterface(self, id): def getMidL2RInterface(self, id):
return self.getMidLeftName(id) + "-eth2" return self.getMidLeftName(id) + "-eth2"

View File

@ -1,9 +1,8 @@
from mpTopo import MpTopo from core.topo import Topo
class MpTwoInterfaceCongestionTopo(Topo):
class MpTwoInterfaceCongestionTopo(MpTopo):
def __init__(self, topoBuilder, parameterFile): def __init__(self, topoBuilder, parameterFile):
MpTopo.__init__(self, topoBuilder, parameterFile) super().__init__(topoBuilder, parameterFile)
print("Hello from topo two ifs cong") print("Hello from topo two ifs cong")
print("Expected topo:") print("Expected topo:")
@ -12,12 +11,12 @@ class MpTwoInterfaceCongestionTopo(MpTopo):
print(" | |------s2") print(" | |------s2")
print("c2----link2----") print("c2----link2----")
self.client = self.addHost(MpTopo.clientName) self.client = self.addHost(Topo.clientName)
self.clientCong = self.addHost(MpTopo.clientName + "Cong") self.clientCong = self.addHost(Topo.clientName + "Cong")
self.server = self.addHost(MpTopo.serverName) self.server = self.addHost(Topo.serverName)
self.serverCong = self.addHost(MpTopo.serverName + "Cong") self.serverCong = self.addHost(Topo.serverName + "Cong")
self.router = self.addHost(MpTopo.routerName) self.router = self.addHost(Topo.routerName)
self.routerCong = self.addHost(MpTopo.routerName + "Cong") self.routerCong = self.addHost(Topo.routerName + "Cong")
self.switch = [] self.switch = []
# Link between c1 and r2 # Link between c1 and r2
@ -53,4 +52,4 @@ class MpTwoInterfaceCongestionTopo(MpTopo):
return s return s
def addOneSwitchPerLink(self, link): def addOneSwitchPerLink(self, link):
return self.addSwitch(MpTopo.switchNamePrefix + str(link.id)) return self.addSwitch(Topo.switchNamePrefix + str(link.id))

View File

@ -1,6 +1,6 @@
from mpTopo import MpTopo from core.experience import Experience, ExperienceParameter, ExperienceParameter
from mpParamTopo import MpParamTopo from core.topo import Topo, TopoParameter
from mpParamXp import MpParamXp
from mpMultiInterfaceTopo import MpMultiInterfaceTopo from mpMultiInterfaceTopo import MpMultiInterfaceTopo
from mpMultiInterfaceConfig import MpMultiInterfaceConfig from mpMultiInterfaceConfig import MpMultiInterfaceConfig
from mpMultiInterfaceCongConfig import MpMultiInterfaceCongConfig from mpMultiInterfaceCongConfig import MpMultiInterfaceCongConfig
@ -8,33 +8,32 @@ from mpMultiInterfaceCongTopo import MpMultiInterfaceCongTopo
from mpECMPSingleInterfaceConfig import MpECMPSingleInterfaceConfig from mpECMPSingleInterfaceConfig import MpECMPSingleInterfaceConfig
from mpTwoInterfaceCongestionConfig import MpTwoInterfaceCongestionConfig from mpTwoInterfaceCongestionConfig import MpTwoInterfaceCongestionConfig
from mpMininetBuilder import MpMininetBuilder from mpMininetBuilder import MpMininetBuilder
from mpExperiencePing import MpExperiencePing from mpExperiencePing import ExperiencePing
from mpExperienceNCPV import MpExperienceNCPV from mpExperienceNCPV import ExperienceNCPV
from mpExperienceNC import MpExperienceNC from mpExperienceNC import ExperienceNC
from mpExperienceHTTPS import MpExperienceHTTPS from mpExperienceHTTPS import ExperienceHTTPS
from mpExperienceHTTP import MpExperienceHTTP from mpExperienceHTTP import ExperienceHTTP
from mpExperienceSendFile import MpExperienceSendFile from mpExperienceSendFile import ExperienceSendFile
from mpExperienceEpload import MpExperienceEpload from mpExperienceEpload import ExperienceEpload
from mpExperienceNetperf import MpExperienceNetperf from mpExperienceNetperf import ExperienceNetperf
from mpExperienceAb import MpExperienceAb from mpExperienceAb import ExperienceAb
from mpExperienceSiri import MpExperienceSiri from mpExperienceSiri import ExperienceSiri
from mpExperienceVLC import MpExperienceVLC from mpExperienceVLC import ExperienceVLC
from mpExperienceIperf import MpExperienceIperf from mpExperienceIperf import ExperienceIperf
from mpExperienceDITG import MpExperienceDITG from mpExperienceDITG import ExperienceDITG
from mpExperienceMsg import MpExperienceMsg from mpExperienceMsg import ExperienceMsg
from mpExperienceSiriHTTP import MpExperienceSiriHTTP from mpExperienceSiriHTTP import ExperienceSiriHTTP
from mpExperienceSiriMsg import MpExperienceSiriMsg from mpExperienceSiriMsg import ExperienceSiriMsg
from mpExperienceQUIC import MpExperienceQUIC from mpExperienceQUIC import ExperienceQUIC
from mpExperienceQUICSiri import MpExperienceQUICSiri from mpExperienceQUICSiri import ExperienceQUICSiri
from mpExperienceNone import MpExperienceNone from mpExperienceNone import ExperienceNone
from mpExperience import MpExperience
from mpECMPSingleInterfaceTopo import MpECMPSingleInterfaceTopo from mpECMPSingleInterfaceTopo import MpECMPSingleInterfaceTopo
from mpTwoInterfaceCongestionTopo import MpTwoInterfaceCongestionTopo from mpTwoInterfaceCongestionTopo import MpTwoInterfaceCongestionTopo
class MpXpRunner: class MpXpRunner:
def __init__(self, builderType, topoParamFile, xpParamFile): def __init__(self, builderType, topoParamFile, xpParamFile):
self.defParamXp(xpParamFile) self.defParamXp(xpParamFile)
self.topoParam = MpParamTopo(topoParamFile) self.topoParam = TopoParameter(topoParamFile)
self.defBuilder(builderType) self.defBuilder(builderType)
self.defTopo() self.defTopo()
self.defConfig() self.defConfig()
@ -43,110 +42,110 @@ class MpXpRunner:
self.stopTopo() self.stopTopo()
def defParamXp(self, xpParamFile): def defParamXp(self, xpParamFile):
self.xpParam = MpParamXp(xpParamFile) self.xpParam = ExperienceParameter(xpParamFile)
def defBuilder(self, builderType): def defBuilder(self, builderType):
if builderType == MpTopo.mininetBuilder: if builderType == Topo.mininetBuilder:
self.topoBuilder = MpMininetBuilder() self.topoBuilder = MpMininetBuilder()
else: else:
raise Exception("I can not find the builder " + raise Exception("I can not find the builder " +
builderType) builderType)
def defTopo(self): def defTopo(self):
t = self.topoParam.getParam(MpTopo.topoAttr) t = self.topoParam.getParam(Topo.topoAttr)
if t == MpTopo.multiIfTopo: if t == Topo.multiIfTopo:
self.mpTopo = MpMultiInterfaceTopo(self.topoBuilder, self.Topo = MpMultiInterfaceTopo(self.topoBuilder,
self.topoParam) self.topoParam)
elif t == MpTopo.ECMPLikeTopo: elif t == Topo.ECMPLikeTopo:
self.mpTopo = MpECMPSingleInterfaceTopo( self.Topo = MpECMPSingleInterfaceTopo(
self.topoBuilder, self.topoBuilder,
self.topoParam) self.topoParam)
elif t == MpTopo.twoIfCongTopo: elif t == Topo.twoIfCongTopo:
self.mpTopo = MpTwoInterfaceCongestionTopo( self.Topo = MpTwoInterfaceCongestionTopo(
self.topoBuilder, self.topoParam) self.topoBuilder, self.topoParam)
elif t == MpTopo.multiIfCongTopo: elif t == Topo.multiIfCongTopo:
self.mpTopo = MpMultiInterfaceCongTopo(self.topoBuilder, self.Topo = MpMultiInterfaceCongTopo(self.topoBuilder,
self.topoParam) self.topoParam)
else: else:
raise Exception("Unfound Topo" + t) raise Exception("Unfound Topo" + t)
print(self.mpTopo) print(self.Topo)
def defConfig(self): def defConfig(self):
t = self.topoParam.getParam(MpTopo.topoAttr) t = self.topoParam.getParam(Topo.topoAttr)
if t == MpTopo.multiIfTopo: if t == Topo.multiIfTopo:
self.mpTopoConfig = MpMultiInterfaceConfig(self.mpTopo, self.TopoConfig = MpMultiInterfaceConfig(self.Topo,
self.topoParam) self.topoParam)
elif t == MpTopo.ECMPLikeTopo: elif t == Topo.ECMPLikeTopo:
self.mpTopoConfig = MpECMPSingleInterfaceConfig( self.TopoConfig = MpECMPSingleInterfaceConfig(
self.mpTopo, self.Topo,
self.topoParam) self.topoParam)
elif t == MpTopo.twoIfCongTopo: elif t == Topo.twoIfCongTopo:
self.mpTopoConfig = MpTwoInterfaceCongestionConfig( self.TopoConfig = MpTwoInterfaceCongestionConfig(
self.mpTopo, self.topoParam) self.Topo, self.topoParam)
elif t == MpTopo.multiIfCongTopo: elif t == Topo.multiIfCongTopo:
self.mpTopoConfig = MpMultiInterfaceCongConfig(self.mpTopo, self.TopoConfig = MpMultiInterfaceCongConfig(self.Topo,
self.topoParam) self.topoParam)
else: else:
raise Exception("Unfound Topo" + t) raise Exception("Unfound Topo" + t)
def startTopo(self): def startTopo(self):
self.mpTopo.startNetwork() self.Topo.startNetwork()
self.mpTopoConfig.configureNetwork() self.TopoConfig.configureNetwork()
def runXp(self): def runXp(self):
xp = self.xpParam.getParam(MpParamXp.XPTYPE) xp = self.xpParam.getParam(ExperienceParameter.XPTYPE)
if xp == MpExperience.PING: if xp ==Experience.PING:
MpExperiencePing(self.xpParam, self.mpTopo, ExperiencePing(self.xpParam, self.Topo,
self.mpTopoConfig) self.TopoConfig)
elif xp == MpExperience.NCPV: elif xp ==Experience.NCPV:
MpExperienceNCPV(self.xpParam, self.mpTopo, ExperienceNCPV(self.xpParam, self.Topo,
self.mpTopoConfig) self.TopoConfig)
elif xp == MpExperience.NC: elif xp ==Experience.NC:
MpExperienceNC(self.xpParam, self.mpTopo, ExperienceNC(self.xpParam, self.Topo,
self.mpTopoConfig) self.TopoConfig)
elif xp == MpExperience.NONE: elif xp ==Experience.NONE:
MpExperienceNone(self.xpParam, self.mpTopo, ExperienceNone(self.xpParam, self.Topo,
self.mpTopoConfig) self.TopoConfig)
elif xp == MpExperience.HTTPS: elif xp ==Experience.HTTPS:
MpExperienceHTTPS(self.xpParam, self.mpTopo, ExperienceHTTPS(self.xpParam, self.Topo,
self.mpTopoConfig) self.TopoConfig)
elif xp == MpExperience.HTTP: elif xp ==Experience.HTTP:
MpExperienceHTTP(self.xpParam, self.mpTopo, ExperienceHTTP(self.xpParam, self.Topo,
self.mpTopoConfig) self.TopoConfig)
elif xp == MpExperience.EPLOAD: elif xp ==Experience.EPLOAD:
MpExperienceEpload(self.xpParam, self.mpTopo, ExperienceEpload(self.xpParam, self.Topo,
self.mpTopoConfig) self.TopoConfig)
elif xp == MpExperience.NETPERF: elif xp ==Experience.NETPERF:
MpExperienceNetperf(self.xpParam, self.mpTopo, ExperienceNetperf(self.xpParam, self.Topo,
self.mpTopoConfig) self.TopoConfig)
elif xp == MpExperience.AB: elif xp ==Experience.AB:
MpExperienceAb(self.xpParam, self.mpTopo, ExperienceAb(self.xpParam, self.Topo,
self.mpTopoConfig) self.TopoConfig)
elif xp == MpExperience.SIRI: elif xp ==Experience.SIRI:
MpExperienceSiri(self.xpParam, self.mpTopo, ExperienceSiri(self.xpParam, self.Topo,
self.mpTopoConfig) self.TopoConfig)
elif xp == MpExperience.SENDFILE: elif xp ==Experience.SENDFILE:
MpExperienceSendFile(self.xpParam, self.mpTopo, ExperienceSendFile(self.xpParam, self.Topo,
self.mpTopoConfig) self.TopoConfig)
elif xp == MpExperience.VLC: elif xp ==Experience.VLC:
MpExperienceVLC(self.xpParam, self.mpTopo, ExperienceVLC(self.xpParam, self.Topo,
self.mpTopoConfig) self.TopoConfig)
elif xp == MpExperience.IPERF: elif xp ==Experience.IPERF:
MpExperienceIperf(self.xpParam, self.mpTopo, ExperienceIperf(self.xpParam, self.Topo,
self.mpTopoConfig) self.TopoConfig)
elif xp == MpExperience.DITG: elif xp ==Experience.DITG:
MpExperienceDITG(self.xpParam, self.mpTopo, self.mpTopoConfig) ExperienceDITG(self.xpParam, self.Topo, self.TopoConfig)
elif xp == MpExperience.MSG: elif xp ==Experience.MSG:
MpExperienceMsg(self.xpParam, self.mpTopo, self.mpTopoConfig) ExperienceMsg(self.xpParam, self.Topo, self.TopoConfig)
elif xp == MpExperience.SIRIHTTP: elif xp ==Experience.SIRIHTTP:
MpExperienceSiriHTTP(self.xpParam, self.mpTopo, self.mpTopoConfig) ExperienceSiriHTTP(self.xpParam, self.Topo, self.TopoConfig)
elif xp == MpExperience.SIRIMSG: elif xp ==Experience.SIRIMSG:
MpExperienceSiriMsg(self.xpParam, self.mpTopo, self.mpTopoConfig) ExperienceSiriMsg(self.xpParam, self.Topo, self.TopoConfig)
elif xp == MpExperience.QUIC: elif xp ==Experience.QUIC:
MpExperienceQUIC(self.xpParam, self.mpTopo, self.mpTopoConfig) ExperienceQUIC(self.xpParam, self.Topo, self.TopoConfig)
elif xp == MpExperience.QUICSIRI: elif xp ==Experience.QUICSIRI:
MpExperienceQUICSiri(self.xpParam, self.mpTopo, self.mpTopoConfig) ExperienceQUICSiri(self.xpParam, self.Topo, self.TopoConfig)
else: else:
print("Unfound xp type..." + xp) print("Unfound xp type..." + xp)
def stopTopo(self): def stopTopo(self):
self.mpTopo.stopNetwork() self.Topo.stopNetwork()