finalize file refactoring of experiences
This commit is contained in:
parent
b5c9306284
commit
8e7e89569b
9
config/xp/iperf
Normal file
9
config/xp/iperf
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#option to dvlp are commented but already there.
|
||||||
|
#kCommit:aaaa
|
||||||
|
#pmCommit:bbb
|
||||||
|
#sysctl:mem,x y z
|
||||||
|
#sysctl:rmem,x y z
|
||||||
|
#sysctl:wmem,x y z
|
||||||
|
xpType:iperf
|
||||||
|
size:10M
|
||||||
|
|
3
config/xp/ping
Normal file
3
config/xp/ping
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
xpType:ping
|
||||||
|
pingCount:16
|
||||||
|
rmem:87380 87380 87380
|
@ -9,24 +9,6 @@ class Experience(object):
|
|||||||
`NAME` attribute.
|
`NAME` attribute.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
NCPV = "ncpv"
|
|
||||||
NC = "nc"
|
|
||||||
|
|
||||||
HTTPS = "https"
|
|
||||||
HTTP = "http"
|
|
||||||
EPLOAD = "epload"
|
|
||||||
NETPERF = "netperf"
|
|
||||||
|
|
||||||
SIRI = "siri"
|
|
||||||
SENDFILE = "sendfile"
|
|
||||||
VLC = "vlc"
|
|
||||||
IPERF = "iperf"
|
|
||||||
MSG = "msg"
|
|
||||||
SIRIHTTP = "sirihttp"
|
|
||||||
SIRIMSG = "sirimsg"
|
|
||||||
QUIC = "quic"
|
|
||||||
QUICSIRI = "quicsiri"
|
|
||||||
|
|
||||||
def __init__(self, xpParam, mpTopo, mpConfig):
|
def __init__(self, xpParam, mpTopo, mpConfig):
|
||||||
self.xpParam = xpParam
|
self.xpParam = xpParam
|
||||||
self.mpTopo = mpTopo
|
self.mpTopo = mpTopo
|
||||||
|
@ -1,45 +1,45 @@
|
|||||||
|
|
||||||
class Parameter(object):
|
class Parameter(object):
|
||||||
def __init__(self, paramFile):
|
def __init__(self, paramFile):
|
||||||
self.paramDic = {}
|
self.paramDic = {}
|
||||||
print("Create the param Object")
|
print("Create the param Object")
|
||||||
if paramFile is None:
|
if paramFile is None:
|
||||||
print("default param...")
|
print("default param...")
|
||||||
else:
|
else:
|
||||||
self.loadParamFile(paramFile)
|
self.loadParamFile(paramFile)
|
||||||
|
|
||||||
def loadParamFile(self, paramFile):
|
def loadParamFile(self, paramFile):
|
||||||
f = open(paramFile)
|
f = open(paramFile)
|
||||||
i = 0
|
i = 0
|
||||||
for l in f:
|
for l in f:
|
||||||
i = i + 1
|
i = i + 1
|
||||||
if l.startswith("#"):
|
if l.startswith("#"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
tab = l.split(":")
|
tab = l.split(":")
|
||||||
if len(tab) == 2:
|
if len(tab) == 2:
|
||||||
k = tab[0]
|
k = tab[0]
|
||||||
val = tab[1].rstrip()
|
val = tab[1].rstrip()
|
||||||
if k in self.paramDic:
|
if k in self.paramDic:
|
||||||
if not isinstance(self.paramDic[k], list):
|
if not isinstance(self.paramDic[k], list):
|
||||||
self.paramDic[k] = [self.paramDic[k]]
|
self.paramDic[k] = [self.paramDic[k]]
|
||||||
self.paramDic[k].append(val)
|
self.paramDic[k].append(val)
|
||||||
else:
|
else:
|
||||||
self.paramDic[k] = val
|
self.paramDic[k] = val
|
||||||
else:
|
else:
|
||||||
print("Ignored Line " + str(i))
|
print("Ignored Line " + str(i))
|
||||||
print(l),
|
print(l),
|
||||||
print("In file " + paramFile)
|
print("In file " + paramFile)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
def getParam(self, key):
|
def getParam(self, key):
|
||||||
if key in self.paramDic:
|
if key in self.paramDic:
|
||||||
return self.paramDic[key]
|
return self.paramDic[key]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
s = self.paramDic.__str__()
|
s = self.paramDic.__str__()
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
||||||
class ExperienceParameter(Parameter):
|
class ExperienceParameter(Parameter):
|
||||||
|
92
experiences/epload.py
Normal file
92
experiences/epload.py
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
from core.experience import Experience, ExperienceParameter
|
||||||
|
import os
|
||||||
|
|
||||||
|
class Epload(Experience):
|
||||||
|
NAME = "epload"
|
||||||
|
|
||||||
|
SERVER_LOG = "http_server.log"
|
||||||
|
EPLOAD_LOG = "epload.log"
|
||||||
|
NODE_BIN = "/usr/local/nodejs/bin/node"
|
||||||
|
EPLOAD_EMULATOR="/home/mininet/epload/epload/emulator/run.js"
|
||||||
|
PING_OUTPUT = "ping.log"
|
||||||
|
|
||||||
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
|
super(Epload, self).__init__(xpParamFile, mpTopo, mpConfig)
|
||||||
|
self.loadParam()
|
||||||
|
self.ping()
|
||||||
|
super(Epload, self).classicRun()
|
||||||
|
|
||||||
|
def ping(self):
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
Epload.PING_OUTPUT )
|
||||||
|
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||||
|
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||||
|
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||||
|
self.mpConfig.getServerIP(), n = count)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
def pingCommand(self, fromIP, toIP, n=5):
|
||||||
|
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||||
|
" >> " + Epload.PING_OUTPUT
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def loadParam(self):
|
||||||
|
self.epload_test_dir = self.xpParam.getParam(ExperienceParameter.EPLOADTESTDIR)
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(Epload, self).prepare()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
Epload.EPLOAD_LOG )
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||||
|
Epload.SERVER_LOG )
|
||||||
|
|
||||||
|
def getHTTPServerCmd(self):
|
||||||
|
s = "/etc/init.d/apache2 restart &>" + Epload.SERVER_LOG + " &"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getKillHTTPCmd(self):
|
||||||
|
s = "ps aux | grep SimpleHTTP | head -1 | tr -s ' ' | cut -d ' ' -f 2 | xargs kill"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getEploadClientCmd(self):
|
||||||
|
s = Epload.NODE_BIN + " " + Epload.EPLOAD_EMULATOR + \
|
||||||
|
" http " + \
|
||||||
|
self.epload_test_dir + " &>" + Epload.EPLOAD_LOG
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getSubHostCmd(self):
|
||||||
|
s = "for f in `ls " + self.epload_test_dir + "/*`; do " + \
|
||||||
|
" sed -i 's/@host@/" + self.mpConfig.getServerIP() + "/' " + \
|
||||||
|
"$f; done"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getSubBackHostCmd(self):
|
||||||
|
s = "for f in `ls " + self.epload_test_dir + "/*`; do " + \
|
||||||
|
" sed -i 's/" + self.mpConfig.getServerIP() + "/@host@/' " + \
|
||||||
|
"$f; done"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super(Epload, self).clean()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
cmd = self.getHTTPServerCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
||||||
|
|
||||||
|
cmd = self.getSubHostCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
cmd = self.getEploadClientCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
cmd = self.getSubBackHostCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
||||||
|
cmd = self.getKillHTTPCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
66
experiences/iperf.py
Normal file
66
experiences/iperf.py
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
from core.experience import Experience, ExperienceParameter
|
||||||
|
import os
|
||||||
|
|
||||||
|
class IPerf(Experience):
|
||||||
|
NAME = "iperf"
|
||||||
|
|
||||||
|
IPERF_LOG = "iperf.log"
|
||||||
|
SERVER_LOG = "server.log"
|
||||||
|
IPERF_BIN = "iperf3"
|
||||||
|
PING_OUTPUT = "ping.log"
|
||||||
|
|
||||||
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
|
super(IPerf, self).__init__(xpParamFile, mpTopo, mpConfig)
|
||||||
|
self.loadParam()
|
||||||
|
self.ping()
|
||||||
|
super(IPerf, self).classicRun()
|
||||||
|
|
||||||
|
def ping(self):
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
IPerf.PING_OUTPUT)
|
||||||
|
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||||
|
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||||
|
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||||
|
self.mpConfig.getServerIP(), n = count)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
def pingCommand(self, fromIP, toIP, n=5):
|
||||||
|
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||||
|
" >> " + IPerf.PING_OUTPUT
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def loadParam(self):
|
||||||
|
self.time = self.xpParam.getParam(ExperienceParameter.IPERFTIME)
|
||||||
|
self.parallel = self.xpParam.getParam(ExperienceParameter.IPERFPARALLEL)
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(IPerf, self).prepare()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " +
|
||||||
|
IPerf.IPERF_LOG)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " +
|
||||||
|
IPerf.SERVER_LOG)
|
||||||
|
|
||||||
|
def getClientCmd(self):
|
||||||
|
s = IPerf.IPERF_BIN + " -c " + self.mpConfig.getServerIP() + \
|
||||||
|
" -t " + self.time + " -P " + self.parallel + " &>" + IPerf.IPERF_LOG
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getServerCmd(self):
|
||||||
|
s = "sudo " + IPerf.IPERF_BIN + " -s &>" + \
|
||||||
|
IPerf.SERVER_LOG + "&"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super(IPerf, self).clean()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
cmd = self.getServerCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
||||||
|
cmd = self.getClientCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
74
experiences/msg.py
Normal file
74
experiences/msg.py
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
from core.experience import Experience, ExperienceParameter
|
||||||
|
import os
|
||||||
|
|
||||||
|
class Msg(Experience):
|
||||||
|
NAME = "msg"
|
||||||
|
|
||||||
|
SERVER_LOG = "msg_server.log"
|
||||||
|
CLIENT_LOG = "msg_client.log"
|
||||||
|
CLIENT_ERR = "msg_client.err"
|
||||||
|
PING_OUTPUT = "ping.log"
|
||||||
|
|
||||||
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
|
super(Msg, self).__init__(xpParamFile, mpTopo, mpConfig)
|
||||||
|
self.loadParam()
|
||||||
|
self.ping()
|
||||||
|
super(Msg, self).classicRun()
|
||||||
|
|
||||||
|
def ping(self):
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
Msg.PING_OUTPUT )
|
||||||
|
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||||
|
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||||
|
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||||
|
self.mpConfig.getServerIP(), n = count)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
def pingCommand(self, fromIP, toIP, n=5):
|
||||||
|
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||||
|
" >> " + Msg.PING_OUTPUT
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def loadParam(self):
|
||||||
|
self.client_sleep = self.xpParam.getParam(ExperienceParameter.MSGCLIENTSLEEP)
|
||||||
|
self.server_sleep = self.xpParam.getParam(ExperienceParameter.MSGSERVERSLEEP)
|
||||||
|
self.nb_requests = self.xpParam.getParam(ExperienceParameter.MSGNBREQUESTS)
|
||||||
|
self.bytes = self.xpParam.getParam(ExperienceParameter.MSGBYTES)
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(Msg, self).prepare()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
Msg.CLIENT_LOG)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||||
|
Msg.SERVER_LOG)
|
||||||
|
|
||||||
|
def getMsgServerCmd(self):
|
||||||
|
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||||
|
"/utils/msg_server.py --sleep " + self.server_sleep + " --bytes " + self.bytes + " &>" + Msg.SERVER_LOG + "&"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getMsgClientCmd(self):
|
||||||
|
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||||
|
"/utils/msg_client.py --sleep " + self.client_sleep + " --nb " + self.nb_requests + \
|
||||||
|
" --bytes " + self.bytes + " >" + Msg.CLIENT_LOG + " 2>" + Msg.CLIENT_ERR
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super(Msg, self).clean()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
cmd = self.getMsgServerCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
||||||
|
cmd = self.getMsgClientCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f msg_server.py")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
78
experiences/nc.py
Normal file
78
experiences/nc.py
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
from core.experience import Experience, ExperienceParameter
|
||||||
|
|
||||||
|
"""
|
||||||
|
Should be the mother of ExperienceNCPV, shame on me, should rewrite
|
||||||
|
ExperienceNCPV as daughter class of this one.
|
||||||
|
"""
|
||||||
|
|
||||||
|
class NC(Experience):
|
||||||
|
NAME = "nc"
|
||||||
|
|
||||||
|
SERVER_NC_LOG = "netcat_server"
|
||||||
|
CLIENT_NC_LOG = "netcat_client"
|
||||||
|
NC_BIN = "netcat"
|
||||||
|
|
||||||
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
|
super(NC, self).__init__(xpParamFile, mpTopo, mpConfig)
|
||||||
|
self.loadParam()
|
||||||
|
super(NC, self).classicRun()
|
||||||
|
|
||||||
|
def loadParam(self):
|
||||||
|
self.ddibs = self.xpParam.getParam(ExperienceParameter.DDIBS)
|
||||||
|
self.ddobs = self.xpParam.getParam(ExperienceParameter.DDOBS)
|
||||||
|
self.ddcount = self.xpParam.getParam(ExperienceParameter.DDCOUNT)
|
||||||
|
self.ncServerPort = self.xpParam.getParam(ExperienceParameter.NCSERVERPORT)
|
||||||
|
self.ncClientPort = []
|
||||||
|
for k in sorted(self.xpParam.paramDic):
|
||||||
|
if k.startswith(ExperienceParameter.NCCLIENTPORT):
|
||||||
|
port = self.xpParam.paramDic[k]
|
||||||
|
self.ncClientPort.append(port)
|
||||||
|
if len(self.ncClientPort) == 0:
|
||||||
|
d = self.xpParam.getParam(ExperienceParameter.NCCLIENTPORT)
|
||||||
|
self.ncClientPort.append(d)
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(NC, self).prepare()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
NC.CLIENT_NC_LOG )
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||||
|
NC.SERVER_NC_LOG )
|
||||||
|
|
||||||
|
def getNCServerCmd(self, id):
|
||||||
|
s = "dd if=/dev/urandom ibs=" + self.ddibs + \
|
||||||
|
" obs=" + self.ddobs + \
|
||||||
|
" count=" + self.ddcount + \
|
||||||
|
" | " + \
|
||||||
|
NC.NC_BIN + \
|
||||||
|
" -l " + self.ncServerPort + \
|
||||||
|
" &>" + NC.SERVER_NC_LOG + \
|
||||||
|
"_" + str(id) + ".log"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getNCClientCmd(self, id):
|
||||||
|
s = NC.NC_BIN + " " + \
|
||||||
|
" -p " + self.ncClientPort[id] + " " + \
|
||||||
|
self.mpConfig.getServerIP() + " " + \
|
||||||
|
self.ncServerPort + " " + \
|
||||||
|
"&>" + NC.CLIENT_NC_LOG + \
|
||||||
|
"_" + str(id) + ".log"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super(NC, self).clean()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
for i in range(0, len(self.ncClientPort)):
|
||||||
|
cmd = self.getNCServerCmd(i)
|
||||||
|
self.mpConfig.server.sendCmd(cmd)
|
||||||
|
|
||||||
|
cmd = self.getNCClientCmd(i)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
self.mpConfig.server.waitOutput()
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 1")
|
||||||
|
|
167
experiences/ncpv.py
Normal file
167
experiences/ncpv.py
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
from core.experience import Experience, ExperienceParameter
|
||||||
|
|
||||||
|
|
||||||
|
class MpPvAt(object):
|
||||||
|
def __init__(self, at, cmd):
|
||||||
|
self.at = at
|
||||||
|
self.cmd = cmd
|
||||||
|
self.delta = 0
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return "Pv... at " + str(self.at) + "(" + str(self.delta) + \
|
||||||
|
") will be " + self.cmd
|
||||||
|
|
||||||
|
|
||||||
|
class NCPV(Experience):
|
||||||
|
"""
|
||||||
|
NC PV : NetCat and Pipe Viewer
|
||||||
|
"""
|
||||||
|
NAME = "ncpv"
|
||||||
|
|
||||||
|
SERVER_NC_LOG = "netcat_server"
|
||||||
|
CLIENT_NC_LOG = "netcat_client"
|
||||||
|
NC_BIN = "/usr/local/bin/nc"
|
||||||
|
PV_BIN = "/usr/local/bin/pv"
|
||||||
|
PING_OUTPUT = "ping.log"
|
||||||
|
|
||||||
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
|
super(NCPV, self).__init__(xpParamFile, mpTopo, mpConfig)
|
||||||
|
self.loadParam()
|
||||||
|
self.ping()
|
||||||
|
super(NCPV, self).classicRun()
|
||||||
|
|
||||||
|
def ping(self):
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
NCPV.PING_OUTPUT )
|
||||||
|
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||||
|
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||||
|
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||||
|
self.mpConfig.getServerIP(), n = count)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
def pingCommand(self, fromIP, toIP, n=5):
|
||||||
|
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||||
|
" >> " + NCPV.PING_OUTPUT
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def loadParam(self):
|
||||||
|
self.pvg = self.xpParam.getParam(ExperienceParameter.PVG)
|
||||||
|
self.pvz = self.xpParam.getParam(ExperienceParameter.PVZ)
|
||||||
|
self.pvRateLimit = self.xpParam.getParam(ExperienceParameter.PVRATELIMIT)
|
||||||
|
self.ddibs = self.xpParam.getParam(ExperienceParameter.DDIBS)
|
||||||
|
self.ddobs = self.xpParam.getParam(ExperienceParameter.DDOBS)
|
||||||
|
self.ddcount = self.xpParam.getParam(ExperienceParameter.DDCOUNT)
|
||||||
|
self.ncServerPort = self.xpParam.getParam(ExperienceParameter.NCSERVERPORT)
|
||||||
|
self.pvRateLimit = self.xpParam.getParam(ExperienceParameter.PVRATELIMIT)
|
||||||
|
self.ncClientPort = []
|
||||||
|
for k in sorted(self.xpParam.paramDic):
|
||||||
|
if k.startswith(ExperienceParameter.NCCLIENTPORT):
|
||||||
|
port = self.xpParam.paramDic[k]
|
||||||
|
self.ncClientPort.append(port)
|
||||||
|
if len(self.ncClientPort) == 0:
|
||||||
|
d = self.xpParam.getParam(ExperienceParameter.NCCLIENTPORT)
|
||||||
|
self.ncClientPort.append(d)
|
||||||
|
self.loadPvAt()
|
||||||
|
|
||||||
|
def loadPvAt(self):
|
||||||
|
self.changePvAt = []
|
||||||
|
self.changePv = self.xpParam.getParam(ExperienceParameter.CHANGEPV)
|
||||||
|
if self.changePv != "yes":
|
||||||
|
print("Don't change pv rate...")
|
||||||
|
return
|
||||||
|
changePvAt = self.xpParam.getParam(ExperienceParameter.CHANGEPVAT)
|
||||||
|
if not isinstance(changePvAt, list):
|
||||||
|
changePvAt = [changePvAt]
|
||||||
|
for p in changePvAt:
|
||||||
|
tab = p.split(",")
|
||||||
|
if len(tab)==2:
|
||||||
|
o = MpPvAt(float(tab[0]), tab[1])
|
||||||
|
self.addPvAt(o)
|
||||||
|
else:
|
||||||
|
print("pv wrong line : " + p)
|
||||||
|
|
||||||
|
def addPvAt(self, p):
|
||||||
|
if len(self.changePvAt) == 0 :
|
||||||
|
p.delta = p.at
|
||||||
|
else:
|
||||||
|
if p.at > self.changePvAt[-1].at:
|
||||||
|
p.delta = p.at - self.changePvAt[-1].at
|
||||||
|
else:
|
||||||
|
print("Do not take into account " + p.__str__() + \
|
||||||
|
"because ooo !")
|
||||||
|
return
|
||||||
|
|
||||||
|
self.changePvAt.append(p)
|
||||||
|
|
||||||
|
def getPvChangeCmd(self):
|
||||||
|
cmd = ""
|
||||||
|
for p in self.changePvAt:
|
||||||
|
cmd = cmd + "sleep " + str(p.delta)
|
||||||
|
cmd = cmd + " && "
|
||||||
|
cmd = cmd + NCPV.PV_BIN + " -R " + self.pvPid
|
||||||
|
cmd = cmd + " " + p.cmd + " && "
|
||||||
|
cmd = cmd + " true &"
|
||||||
|
return cmd
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(NCPV, self).prepare()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
NCPV.CLIENT_NC_LOG )
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||||
|
NCPV.SERVER_NC_LOG )
|
||||||
|
|
||||||
|
def getNCServerCmd(self, id):
|
||||||
|
s = NCPV.NC_BIN + " -d " + \
|
||||||
|
" -l " + self.ncServerPort + \
|
||||||
|
" 1>/dev/null 2>" + NCPV.SERVER_NC_LOG + \
|
||||||
|
"_" + str(id) + ".log &"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getNCClientCmd(self, id):
|
||||||
|
s = "dd if=/dev/urandom ibs=" + self.ddibs + \
|
||||||
|
" obs=" + self.ddobs + \
|
||||||
|
" count=" + self.ddcount + \
|
||||||
|
" | " + NCPV.PV_BIN + \
|
||||||
|
" -g " + self.pvg + " -z " + self.pvz + \
|
||||||
|
" -q --rate-limit " + self.pvRateLimit + \
|
||||||
|
" | " + NCPV.NC_BIN + " " + \
|
||||||
|
" -p " + self.ncClientPort[id] + " " + \
|
||||||
|
self.mpConfig.getServerIP() + " " + \
|
||||||
|
self.ncServerPort + " " + \
|
||||||
|
"&>" + NCPV.CLIENT_NC_LOG + \
|
||||||
|
"_" + str(id) + ".log"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
def getPvPidCmd(self):
|
||||||
|
s = "pgrep -n pv"
|
||||||
|
return s
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super(NCPV, self).clean()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
for i in range(0, len(self.ncClientPort)):
|
||||||
|
cmd = self.getNCServerCmd(i)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
|
||||||
|
cmd = self.getNCClientCmd(i)
|
||||||
|
self.mpConfig.client.sendCmd(cmd)
|
||||||
|
|
||||||
|
cmd = self.getPvPidCmd()
|
||||||
|
self.pvPid = None
|
||||||
|
while self.pvPid == None or self.pvPid == "":
|
||||||
|
self.pvPid = self.mpTopo.commandTo(self.mpConfig.server, cmd)[:-1]
|
||||||
|
print("guessing pv pid ... :" + str(self.pvPid))
|
||||||
|
|
||||||
|
cmd = self.getPvChangeCmd()
|
||||||
|
print(cmd)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
|
||||||
|
|
||||||
|
self.mpConfig.client.waitOutput()
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 1")
|
||||||
|
|
69
experiences/netperf.py
Normal file
69
experiences/netperf.py
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
from core.experience import Experience, ExperienceParameter
|
||||||
|
import os
|
||||||
|
|
||||||
|
class Netperf(Experience):
|
||||||
|
NAME = "netperf"
|
||||||
|
|
||||||
|
NETPERF_LOG = "netperf.log"
|
||||||
|
NETSERVER_LOG = "netserver.log"
|
||||||
|
NETPERF_BIN = "netperf"
|
||||||
|
NETSERVER_BIN = "netserver"
|
||||||
|
PING_OUTPUT = "ping.log"
|
||||||
|
|
||||||
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
|
super(Netperf, self).__init__(xpParamFile, mpTopo, mpConfig)
|
||||||
|
self.loadParam()
|
||||||
|
self.ping()
|
||||||
|
super(Netperf, self).classicRun()
|
||||||
|
|
||||||
|
def ping(self):
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
Netperf.PING_OUTPUT)
|
||||||
|
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||||
|
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||||
|
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||||
|
self.mpConfig.getServerIP(), n = count)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
def pingCommand(self, fromIP, toIP, n=5):
|
||||||
|
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||||
|
" >> " + Netperf.PING_OUTPUT
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def loadParam(self):
|
||||||
|
self.testlen = self.xpParam.getParam(ExperienceParameter.NETPERFTESTLEN)
|
||||||
|
self.testname = self.xpParam.getParam(ExperienceParameter.NETPERFTESTNAME)
|
||||||
|
self.reqres_size = self.xpParam.getParam(ExperienceParameter.NETPERFREQRESSIZE)
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(Netperf, self).prepare()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " +
|
||||||
|
Netperf.NETPERF_LOG)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " +
|
||||||
|
Netperf.NETSERVER_LOG)
|
||||||
|
|
||||||
|
def getClientCmd(self):
|
||||||
|
s = Netperf.NETPERF_BIN + " -H " + self.mpConfig.getServerIP() + \
|
||||||
|
" -l " + self.testlen + " -t " + self.testname + " -- -r " + self.reqres_size + \
|
||||||
|
" &>" + Netperf.NETPERF_LOG
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getServerCmd(self):
|
||||||
|
s = "sudo " + Netperf.NETSERVER_BIN + " &>" + \
|
||||||
|
Netperf.NETSERVER_LOG + "&"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super(Netperf, self).clean()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
cmd = self.getServerCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
||||||
|
cmd = self.getClientCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
@ -1,31 +1,31 @@
|
|||||||
from core.experience import Experience, ExperienceParameter
|
from core.experience import Experience, ExperienceParameter
|
||||||
|
|
||||||
class Ping(Experience):
|
class Ping(Experience):
|
||||||
NAME = "ping"
|
NAME = "ping"
|
||||||
|
|
||||||
PING_OUTPUT = "ping.log"
|
PING_OUTPUT = "ping.log"
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
super(Ping, self).__init__(xpParamFile, mpTopo, mpConfig)
|
super(Ping, self).__init__(xpParamFile, mpTopo, mpConfig)
|
||||||
super(Ping, self).classicRun()
|
super(Ping, self).classicRun()
|
||||||
|
|
||||||
def prepare(self):
|
def prepare(self):
|
||||||
super(Ping, self).prepare()
|
super(Ping, self).prepare()
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
super(Ping, self).clean()
|
super(Ping, self).clean()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
Ping.PING_OUTPUT )
|
Ping.PING_OUTPUT )
|
||||||
count = self.xpParam.getParam(ExperienceParameter.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)
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
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 + \
|
||||||
" >> " + Ping.PING_OUTPUT
|
" >> " + Ping.PING_OUTPUT
|
||||||
print(s)
|
print(s)
|
||||||
return s
|
return s
|
||||||
|
128
experiences/quic.py
Normal file
128
experiences/quic.py
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
from core.experience import Experience, ExperienceParameter
|
||||||
|
from topos.multi_interface_cong import MultiInterfaceCongConfig
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
class QUIC(Experience):
|
||||||
|
NAME = "quic"
|
||||||
|
|
||||||
|
GO_BIN = "/usr/local/go/bin/go"
|
||||||
|
WGET = "~/git/wget/src/wget"
|
||||||
|
SERVER_LOG = "quic_server.log"
|
||||||
|
CLIENT_LOG = "quic_client.log"
|
||||||
|
CLIENT_GO_FILE = "~/go/src/github.com/lucas-clemente/quic-go/example/client_benchmarker_cached/main.go"
|
||||||
|
SERVER_GO_FILE = "~/go/src/github.com/lucas-clemente/quic-go/example/main.go"
|
||||||
|
CERTPATH = "~/go/src/github.com/lucas-clemente/quic-go/example/"
|
||||||
|
PING_OUTPUT = "ping.log"
|
||||||
|
|
||||||
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
|
super(QUIC, self).__init__(xpParamFile, mpTopo, mpConfig)
|
||||||
|
self.loadParam()
|
||||||
|
self.ping()
|
||||||
|
super(QUIC, self).classicRun()
|
||||||
|
|
||||||
|
def ping(self):
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
QUIC.PING_OUTPUT )
|
||||||
|
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||||
|
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||||
|
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||||
|
self.mpConfig.getServerIP(), n = count)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
def pingCommand(self, fromIP, toIP, n=5):
|
||||||
|
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||||
|
" >> " + QUIC.PING_OUTPUT
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def loadParam(self):
|
||||||
|
self.file = self.xpParam.getParam(ExperienceParameter.HTTPSFILE)
|
||||||
|
self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPSRANDOMSIZE)
|
||||||
|
self.multipath = self.xpParam.getParam(ExperienceParameter.QUICMULTIPATH)
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(QUIC, self).prepare()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
QUIC.CLIENT_LOG )
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||||
|
QUIC.SERVER_LOG )
|
||||||
|
if self.file == "random":
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client,
|
||||||
|
"dd if=/dev/urandom of=random bs=1K count=" + \
|
||||||
|
self.random_size)
|
||||||
|
|
||||||
|
def getQUICServerCmd(self):
|
||||||
|
s = QUIC.GO_BIN + " run " + QUIC.SERVER_GO_FILE
|
||||||
|
s += " -www . -certpath " + QUIC.CERTPATH + " &>"
|
||||||
|
s += QUIC.SERVER_LOG + " &"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getQUICClientCmd(self):
|
||||||
|
s = QUIC.GO_BIN + " run " + QUIC.CLIENT_GO_FILE
|
||||||
|
if int(self.multipath) > 0:
|
||||||
|
s += " -m"
|
||||||
|
s += " https://" + self.mpConfig.getServerIP() + ":6121/random &>" + QUIC.CLIENT_LOG
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getCongServerCmd(self, congID):
|
||||||
|
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||||
|
"/utils/https_server.py &> https_server" + str(congID) + ".log &"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getCongClientCmd(self, congID):
|
||||||
|
s = "(time " + QUIC.WGET + " https://" + self.mpConfig.getCongServerIP(congID) +\
|
||||||
|
"/" + self.file + " --no-check-certificate --disable-mptcp) &> https_client" + str(congID) + ".log &"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super(QUIC, self).clean()
|
||||||
|
if self.file == "random":
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
cmd = self.getQUICServerCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
|
||||||
|
if isinstance(self.mpConfig, MultiInterfaceCongConfig):
|
||||||
|
i = 0
|
||||||
|
for cs in self.mpConfig.cong_servers:
|
||||||
|
cmd = self.getCongServerCmd(i)
|
||||||
|
self.mpTopo.commandTo(cs, cmd)
|
||||||
|
i = i + 1
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before")
|
||||||
|
# First run congestion clients, then the main one
|
||||||
|
if isinstance(self.mpConfig, MultiInterfaceCongConfig):
|
||||||
|
i = 0
|
||||||
|
for cc in self.mpConfig.cong_clients:
|
||||||
|
cmd = self.getCongClientCmd(i)
|
||||||
|
self.mpTopo.commandTo(cc, cmd)
|
||||||
|
i = i + 1
|
||||||
|
|
||||||
|
cmd = self.getQUICClientCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after")
|
||||||
|
# Wait for congestion traffic to end
|
||||||
|
if isinstance(self.mpConfig, MultiInterfaceCongConfig):
|
||||||
|
for cc in self.mpConfig.cong_clients:
|
||||||
|
self.mpTopo.commandTo(cc, "while pkill -f wget -0; do sleep 0.5; done")
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f " + QUIC.SERVER_GO_FILE)
|
||||||
|
if isinstance(self.mpConfig, MultiInterfaceCongConfig):
|
||||||
|
for cs in self.mpConfig.cong_servers:
|
||||||
|
self.mpTopo.commandTo(cs, "pkill -f https_server.py")
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
||||||
|
# Need to delete the go-build directory in tmp; could lead to no more space left error
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm -r /tmp/go-build*")
|
||||||
|
# Remove cache data
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm cache_*")
|
79
experiences/quic_siri.py
Normal file
79
experiences/quic_siri.py
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
from core.experience import Experience, ExperienceParameter
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
class QUICSiri(Experience):
|
||||||
|
NAME = "quicsiri"
|
||||||
|
|
||||||
|
GO_BIN = "/usr/local/go/bin/go"
|
||||||
|
SERVER_LOG = "quic_server.log"
|
||||||
|
CLIENT_LOG = "quic_client.log"
|
||||||
|
CLIENT_GO_FILE = "~/go/src/github.com/lucas-clemente/quic-go/example/siri/client/siri.go"
|
||||||
|
SERVER_GO_FILE = "~/go/src/github.com/lucas-clemente/quic-go/example/siri/siri.go"
|
||||||
|
PING_OUTPUT = "ping.log"
|
||||||
|
|
||||||
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
|
super(QUICSiri, self).__init__(xpParamFile, mpTopo, mpConfig)
|
||||||
|
self.loadParam()
|
||||||
|
self.ping()
|
||||||
|
super(QUICSiri, self).classicRun()
|
||||||
|
|
||||||
|
def ping(self):
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
QUICSiri.PING_OUTPUT )
|
||||||
|
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||||
|
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||||
|
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||||
|
self.mpConfig.getServerIP(), n = count)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
def pingCommand(self, fromIP, toIP, n=5):
|
||||||
|
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||||
|
" >> " + QUICSiri.PING_OUTPUT
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def loadParam(self):
|
||||||
|
self.run_time = self.xpParam.getParam(ExperienceParameter.QUICSIRIRUNTIME)
|
||||||
|
self.multipath = self.xpParam.getParam(ExperienceParameter.QUICMULTIPATH)
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(QUICSiri, self).prepare()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
QUICSiri.CLIENT_LOG )
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||||
|
QUICSiri.SERVER_LOG )
|
||||||
|
|
||||||
|
def getQUICSiriServerCmd(self):
|
||||||
|
s = QUICSiri.GO_BIN + " run " + QUICSiri.SERVER_GO_FILE
|
||||||
|
s += " -addr 0.0.0.0:8080 &>" + QUICSiri.SERVER_LOG + " &"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getQUICSiriClientCmd(self):
|
||||||
|
s = QUICSiri.GO_BIN + " run " + QUICSiri.CLIENT_GO_FILE
|
||||||
|
s += " -addr " + self.mpConfig.getServerIP() + ":8080 -runTime " + self.run_time + "s"
|
||||||
|
if int(self.multipath) > 0:
|
||||||
|
s += " -m"
|
||||||
|
s += " &>" + QUICSiri.CLIENT_LOG
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super(QUICSiri, self).clean()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
cmd = self.getQUICSiriServerCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
||||||
|
cmd = self.getQUICSiriClientCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f " + QUICSiri.SERVER_GO_FILE)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
||||||
|
# Need to delete the go-build directory in tmp; could lead to no more space left error
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm -r /tmp/go-build*")
|
70
experiences/send_file.py
Normal file
70
experiences/send_file.py
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
from core.experience import Experience, ExperienceParameter
|
||||||
|
import os
|
||||||
|
|
||||||
|
class SendFile(Experience):
|
||||||
|
NAME = "sendfile"
|
||||||
|
|
||||||
|
SERVER_LOG = "sendfile_server.log"
|
||||||
|
CLIENT_LOG = "sendfile_client.log"
|
||||||
|
WGET_BIN = "./client"
|
||||||
|
PING_OUTPUT = "ping.log"
|
||||||
|
|
||||||
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
|
super(SendFile, self).__init__(xpParamFile, mpTopo, mpConfig)
|
||||||
|
self.loadParam()
|
||||||
|
self.ping()
|
||||||
|
super(SendFile, self).classicRun()
|
||||||
|
|
||||||
|
def ping(self):
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
SendFile.PING_OUTPUT )
|
||||||
|
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||||
|
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||||
|
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||||
|
self.mpConfig.getServerIP(), n = count)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
def pingCommand(self, fromIP, toIP, n=5):
|
||||||
|
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||||
|
" >> " + SendFile.PING_OUTPUT
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def loadParam(self):
|
||||||
|
self.file = self.xpParam.getParam(ExperienceParameter.HTTPSFILE)
|
||||||
|
self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPSRANDOMSIZE)
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(SendFile, self).prepare()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
SendFile.CLIENT_LOG )
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||||
|
SendFile.SERVER_LOG )
|
||||||
|
if self.file == "random":
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client,
|
||||||
|
"dd if=/dev/urandom of=random bs=1K count=" + \
|
||||||
|
self.random_size)
|
||||||
|
|
||||||
|
def getSendFileServerCmd(self):
|
||||||
|
s = "./server &>" + SendFile.SERVER_LOG + "&"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getSendFileClientCmd(self):
|
||||||
|
s = SendFile.WGET_BIN + " " + self.mpConfig.getServerIP() + " &>" + SendFile.CLIENT_LOG
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super(SendFile, self).clean()
|
||||||
|
if self.file == "random":
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
cmd = self.getSendFileServerCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 0.1")
|
||||||
|
cmd = self.getSendFileClientCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
83
experiences/siri.py
Normal file
83
experiences/siri.py
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
from core.experience import Experience, ExperienceParameter
|
||||||
|
import os
|
||||||
|
|
||||||
|
class Siri(Experience):
|
||||||
|
NAME = "siri"
|
||||||
|
|
||||||
|
SERVER_LOG = "siri_server.log"
|
||||||
|
CLIENT_LOG = "siri_client.log"
|
||||||
|
CLIENT_ERR = "siri_client.err"
|
||||||
|
JAVA_BIN = "java"
|
||||||
|
PING_OUTPUT = "ping.log"
|
||||||
|
|
||||||
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
|
super(Siri, self).__init__(xpParamFile, mpTopo, mpConfig)
|
||||||
|
self.loadParam()
|
||||||
|
self.ping()
|
||||||
|
super(Siri, self).classicRun()
|
||||||
|
|
||||||
|
def ping(self):
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
Siri.PING_OUTPUT )
|
||||||
|
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||||
|
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||||
|
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||||
|
self.mpConfig.getServerIP(), n = count)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
def pingCommand(self, fromIP, toIP, n=5):
|
||||||
|
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||||
|
" >> " + Siri.PING_OUTPUT
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def loadParam(self):
|
||||||
|
self.run_time = self.xpParam.getParam(ExperienceParameter.SIRIRUNTIME)
|
||||||
|
self.query_size = self.xpParam.getParam(ExperienceParameter.SIRIQUERYSIZE)
|
||||||
|
self.response_size = self.xpParam.getParam(ExperienceParameter.SIRIRESPONSESIZE)
|
||||||
|
self.delay_query_response = self.xpParam.getParam(ExperienceParameter.SIRIDELAYQUERYRESPONSE)
|
||||||
|
self.min_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMINPAYLOADSIZE)
|
||||||
|
self.max_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMAXPAYLOADSIZE)
|
||||||
|
self.interval_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALTIMEMS)
|
||||||
|
self.buffer_size = self.xpParam.getParam(ExperienceParameter.SIRIBUFFERSIZE)
|
||||||
|
self.burst_size = self.xpParam.getParam(ExperienceParameter.SIRIBURSTSIZE)
|
||||||
|
self.interval_burst_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALBURSTTIMEMS)
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(Siri, self).prepare()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
Siri.CLIENT_LOG)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||||
|
Siri.SERVER_LOG)
|
||||||
|
|
||||||
|
def getSiriServerCmd(self):
|
||||||
|
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||||
|
"/utils/siri_server.py &>" + Siri.SERVER_LOG + "&"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getSiriClientCmd(self):
|
||||||
|
s = Siri.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/utils/siriClient.jar " + \
|
||||||
|
self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
|
||||||
|
" " + self.delay_query_response + " " + self.min_payload_size + " " + \
|
||||||
|
self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + " " + self.burst_size + " " + self.interval_burst_time_ms + \
|
||||||
|
" >" + Siri.CLIENT_LOG + " 2>" + Siri.CLIENT_ERR
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super(Siri, self).clean()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
cmd = self.getSiriServerCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
||||||
|
cmd = self.getSiriClientCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f siri_server.py")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
114
experiences/siri_http.py
Normal file
114
experiences/siri_http.py
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
from core.experience import Experience, ExperienceParameter
|
||||||
|
import os
|
||||||
|
|
||||||
|
class SiriHTTP(Experience):
|
||||||
|
NAME = "sirihttp"
|
||||||
|
|
||||||
|
HTTP_SERVER_LOG = "http_server.log"
|
||||||
|
HTTP_CLIENT_LOG = "http_client.log"
|
||||||
|
WGET_BIN = "wget"
|
||||||
|
SERVER_LOG = "siri_server.log"
|
||||||
|
CLIENT_LOG = "siri_client.log"
|
||||||
|
CLIENT_ERR = "siri_client.err"
|
||||||
|
JAVA_BIN = "java"
|
||||||
|
PING_OUTPUT = "ping.log"
|
||||||
|
|
||||||
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
|
super(SiriHTTP, self).__init__(xpParamFile, mpTopo, mpConfig)
|
||||||
|
self.loadParam()
|
||||||
|
self.ping()
|
||||||
|
super(SiriHTTP, self).classicRun()
|
||||||
|
|
||||||
|
def ping(self):
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
SiriHTTP.PING_OUTPUT )
|
||||||
|
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||||
|
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||||
|
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||||
|
self.mpConfig.getServerIP(), n = count)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
def pingCommand(self, fromIP, toIP, n=5):
|
||||||
|
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||||
|
" >> " + SiriHTTP.PING_OUTPUT
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def loadParam(self):
|
||||||
|
self.run_time = self.xpParam.getParam(ExperienceParameter.SIRIRUNTIME)
|
||||||
|
self.query_size = self.xpParam.getParam(ExperienceParameter.SIRIQUERYSIZE)
|
||||||
|
self.response_size = self.xpParam.getParam(ExperienceParameter.SIRIRESPONSESIZE)
|
||||||
|
self.delay_query_response = self.xpParam.getParam(ExperienceParameter.SIRIDELAYQUERYRESPONSE)
|
||||||
|
self.min_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMINPAYLOADSIZE)
|
||||||
|
self.max_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMAXPAYLOADSIZE)
|
||||||
|
self.interval_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALTIMEMS)
|
||||||
|
self.buffer_size = self.xpParam.getParam(ExperienceParameter.SIRIBUFFERSIZE)
|
||||||
|
self.burst_size = self.xpParam.getParam(ExperienceParameter.SIRIBURSTSIZE)
|
||||||
|
self.interval_burst_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALBURSTTIMEMS)
|
||||||
|
self.file = self.xpParam.getParam(ExperienceParameter.HTTPFILE)
|
||||||
|
self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPRANDOMSIZE)
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(SiriHTTP, self).prepare()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
SiriHTTP.CLIENT_LOG)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||||
|
SiriHTTP.SERVER_LOG)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
SiriHTTP.HTTP_CLIENT_LOG)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||||
|
SiriHTTP.HTTP_SERVER_LOG)
|
||||||
|
if self.file == "random":
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client,
|
||||||
|
"dd if=/dev/urandom of=random bs=1K count=" + \
|
||||||
|
self.random_size)
|
||||||
|
|
||||||
|
|
||||||
|
def getSiriServerCmd(self):
|
||||||
|
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||||
|
"/utils/siri_server.py &>" + SiriHTTP.SERVER_LOG + "&"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getSiriClientCmd(self):
|
||||||
|
s = SiriHTTP.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/utils/siriClient.jar " + \
|
||||||
|
self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
|
||||||
|
" " + self.delay_query_response + " " + self.min_payload_size + " " + \
|
||||||
|
self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + " " + self.burst_size + " " + self.interval_burst_time_ms + \
|
||||||
|
" >" + SiriHTTP.CLIENT_LOG + " 2>" + SiriHTTP.CLIENT_ERR
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getHTTPServerCmd(self):
|
||||||
|
s = "/etc/init.d/apache2 restart &>" + SiriHTTP.SERVER_LOG + "&"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getHTTPClientCmd(self):
|
||||||
|
s = SiriHTTP.WGET_BIN + " http://" + self.mpConfig.getServerIP() + \
|
||||||
|
"/" + self.file + " --no-check-certificate"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super(SiriHTTP, self).clean()
|
||||||
|
if self.file == "random":
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
cmd = self.getSiriServerCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
cmd = self.getHTTPServerCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before")
|
||||||
|
cmd = self.getHTTPClientCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "for i in {1..200}; do " + cmd + "; done &")
|
||||||
|
cmd = self.getSiriClientCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f siri_server.py")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
116
experiences/siri_msg.py
Normal file
116
experiences/siri_msg.py
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
from core.experience import Experience, ExperienceParameter
|
||||||
|
import os
|
||||||
|
|
||||||
|
class SiriMsg(Experience):
|
||||||
|
NAME = "sirimsg"
|
||||||
|
|
||||||
|
MSG_SERVER_LOG = "msg_server.log"
|
||||||
|
MSG_CLIENT_LOG = "msg_client.log"
|
||||||
|
MSG_CLIENT_ERR = "msg_client.err"
|
||||||
|
SERVER_LOG = "siri_server.log"
|
||||||
|
CLIENT_LOG = "siri_client.log"
|
||||||
|
CLIENT_ERR = "siri_client.err"
|
||||||
|
JAVA_BIN = "java"
|
||||||
|
PING_OUTPUT = "ping.log"
|
||||||
|
|
||||||
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
|
super(SiriMsg, self).__init__(xpParamFile, mpTopo, mpConfig)
|
||||||
|
self.loadParam()
|
||||||
|
self.ping()
|
||||||
|
super(SiriMsg, self).classicRun()
|
||||||
|
|
||||||
|
def ping(self):
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
SiriMsg.PING_OUTPUT )
|
||||||
|
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||||
|
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||||
|
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||||
|
self.mpConfig.getServerIP(), n = count)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
def pingCommand(self, fromIP, toIP, n=5):
|
||||||
|
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||||
|
" >> " + SiriMsg.PING_OUTPUT
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def loadParam(self):
|
||||||
|
self.run_time = self.xpParam.getParam(ExperienceParameter.SIRIRUNTIME)
|
||||||
|
self.query_size = self.xpParam.getParam(ExperienceParameter.SIRIQUERYSIZE)
|
||||||
|
self.response_size = self.xpParam.getParam(ExperienceParameter.SIRIRESPONSESIZE)
|
||||||
|
self.delay_query_response = self.xpParam.getParam(ExperienceParameter.SIRIDELAYQUERYRESPONSE)
|
||||||
|
self.min_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMINPAYLOADSIZE)
|
||||||
|
self.max_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMAXPAYLOADSIZE)
|
||||||
|
self.interval_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALTIMEMS)
|
||||||
|
self.buffer_size = self.xpParam.getParam(ExperienceParameter.SIRIBUFFERSIZE)
|
||||||
|
self.burst_size = self.xpParam.getParam(ExperienceParameter.SIRIBURSTSIZE)
|
||||||
|
self.interval_burst_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALBURSTTIMEMS)
|
||||||
|
self.client_sleep = self.xpParam.getParam(ExperienceParameter.MSGCLIENTSLEEP)
|
||||||
|
self.server_sleep = self.xpParam.getParam(ExperienceParameter.MSGSERVERSLEEP)
|
||||||
|
self.nb_requests = self.xpParam.getParam(ExperienceParameter.MSGNBREQUESTS)
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(SiriMsg, self).prepare()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
SiriMsg.CLIENT_LOG)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
SiriMsg.CLIENT_ERR)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||||
|
SiriMsg.SERVER_LOG)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
SiriMsg.MSG_CLIENT_LOG)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
SiriMsg.MSG_CLIENT_ERR)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||||
|
SiriMsg.MSG_SERVER_LOG)
|
||||||
|
|
||||||
|
def getSiriServerCmd(self):
|
||||||
|
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||||
|
"/utils/siri_server.py &>" + SiriMsg.SERVER_LOG + "&"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getSiriClientCmd(self):
|
||||||
|
s = SiriMsg.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/utils/siriClient.jar " + \
|
||||||
|
self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
|
||||||
|
" " + self.delay_query_response + " " + self.min_payload_size + " " + \
|
||||||
|
self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + " " + self.burst_size + " " + self.interval_burst_time_ms + \
|
||||||
|
" >" + SiriMsg.CLIENT_LOG + " 2>" + SiriMsg.CLIENT_ERR
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getMsgServerCmd(self):
|
||||||
|
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||||
|
"/utils/msg_server.py --sleep " + self.server_sleep + " &>" + SiriMsg.MSG_SERVER_LOG + "&"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getMsgClientCmd(self):
|
||||||
|
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
||||||
|
"/utils/msg_client.py --sleep " + self.client_sleep + " --nb " + self.nb_requests + \
|
||||||
|
" --bulk >" + SiriMsg.MSG_CLIENT_LOG + " 2>" + SiriMsg.MSG_CLIENT_ERR + "&"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super(SiriMsg, self).clean()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
cmd = self.getSiriServerCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
cmd = self.getMsgServerCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before")
|
||||||
|
cmd = self.getMsgClientCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
cmd = self.getSiriClientCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f siri_server.py")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f msg_server.py")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f msg_client.py")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
83
experiences/vlc.py
Normal file
83
experiences/vlc.py
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
from core.experience import Experience, ExperienceParameter
|
||||||
|
import os
|
||||||
|
|
||||||
|
class VLC(Experience):
|
||||||
|
NAME = "vlc"
|
||||||
|
|
||||||
|
SERVER_LOG = "vlc_server.log"
|
||||||
|
CLIENT_LOG = "vlc_client.log"
|
||||||
|
VLC_BIN = "/home/mininet/vlc/vlc"
|
||||||
|
PING_OUTPUT = "ping.log"
|
||||||
|
|
||||||
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
|
super(VLC, self).__init__(xpParamFile, mpTopo, mpConfig)
|
||||||
|
self.loadParam()
|
||||||
|
self.ping()
|
||||||
|
super(VLC, self).classicRun()
|
||||||
|
|
||||||
|
def ping(self):
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
VLC.PING_OUTPUT )
|
||||||
|
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
||||||
|
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||||
|
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||||
|
self.mpConfig.getServerIP(), n = count)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
def pingCommand(self, fromIP, toIP, n=5):
|
||||||
|
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||||
|
" >> " + VLC.PING_OUTPUT
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def loadParam(self):
|
||||||
|
self.file = self.xpParam.getParam(ExperienceParameter.VLCFILE)
|
||||||
|
self.time = self.xpParam.getParam(ExperienceParameter.VLCTIME)
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(VLC, self).prepare()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
VLC.CLIENT_LOG )
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "Xvfb :66 &")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||||
|
VLC.SERVER_LOG )
|
||||||
|
if self.file == "random":
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client,
|
||||||
|
"dd if=/dev/urandom of=random bs=1K count=" + \
|
||||||
|
self.random_size)
|
||||||
|
|
||||||
|
def getVLCServerCmd(self):
|
||||||
|
s = "/etc/init.d/apache2 restart &>" + VLC.SERVER_LOG + " "
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def getVLCClientCmd(self):
|
||||||
|
s = "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/mininet/usr/lib/ && sudo ldconfig && " \
|
||||||
|
+ VLC.VLC_BIN + " -I dummy --x11-display :66" + \
|
||||||
|
" --adaptive-logic 3 --no-loop --play-and-exit " + \
|
||||||
|
" http://" + self.mpConfig.getServerIP() + \
|
||||||
|
"/" + self.file + " 2>&1 | grep -E '(Neb|halp|bandwidth|late|Buffering|buffering)' > " + VLC.CLIENT_LOG
|
||||||
|
if self.time != "0" :
|
||||||
|
s = s + " &"
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super(VLC, self).clean(self)
|
||||||
|
if self.file == "random":
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "pkill Xvfb")
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
cmd = self.getVLCServerCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 1")
|
||||||
|
cmd = self.getVLCClientCmd()
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
if self.time != "0" :
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep " + self.time)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "pkill -9 -f vlc")
|
||||||
|
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
@ -1,90 +0,0 @@
|
|||||||
from core.experience import Experience, ExperienceParameter
|
|
||||||
import os
|
|
||||||
|
|
||||||
class ExperienceEpload(Experience):
|
|
||||||
SERVER_LOG = "http_server.log"
|
|
||||||
EPLOAD_LOG = "epload.log"
|
|
||||||
NODE_BIN = "/usr/local/nodejs/bin/node"
|
|
||||||
EPLOAD_EMULATOR="/home/mininet/epload/epload/emulator/run.js"
|
|
||||||
PING_OUTPUT = "ping.log"
|
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
|
||||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
|
||||||
self.loadParam()
|
|
||||||
self.ping()
|
|
||||||
Experience.classicRun(self)
|
|
||||||
|
|
||||||
def ping(self):
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceEpload.PING_OUTPUT )
|
|
||||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
|
||||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
|
||||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
|
||||||
self.mpConfig.getServerIP(), n = count)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
def pingCommand(self, fromIP, toIP, n=5):
|
|
||||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
|
||||||
" >> " + ExperienceEpload.PING_OUTPUT
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def loadParam(self):
|
|
||||||
self.epload_test_dir = self.xpParam.getParam(ExperienceParameter.EPLOADTESTDIR)
|
|
||||||
|
|
||||||
def prepare(self):
|
|
||||||
Experience.prepare(self)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceEpload.EPLOAD_LOG )
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
|
||||||
ExperienceEpload.SERVER_LOG )
|
|
||||||
|
|
||||||
def getHTTPServerCmd(self):
|
|
||||||
s = "/etc/init.d/apache2 restart &>" + ExperienceEpload.SERVER_LOG + " &"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getKillHTTPCmd(self):
|
|
||||||
s = "ps aux | grep SimpleHTTP | head -1 | tr -s ' ' | cut -d ' ' -f 2 | xargs kill"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getEploadClientCmd(self):
|
|
||||||
s = ExperienceEpload.NODE_BIN + " " + ExperienceEpload.EPLOAD_EMULATOR + \
|
|
||||||
" http " + \
|
|
||||||
self.epload_test_dir + " &>" + ExperienceEpload.EPLOAD_LOG
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getSubHostCmd(self):
|
|
||||||
s = "for f in `ls " + self.epload_test_dir + "/*`; do " + \
|
|
||||||
" sed -i 's/@host@/" + self.mpConfig.getServerIP() + "/' " + \
|
|
||||||
"$f; done"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getSubBackHostCmd(self):
|
|
||||||
s = "for f in `ls " + self.epload_test_dir + "/*`; do " + \
|
|
||||||
" sed -i 's/" + self.mpConfig.getServerIP() + "/@host@/' " + \
|
|
||||||
"$f; done"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
Experience.clean(self)
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
cmd = self.getHTTPServerCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
||||||
|
|
||||||
cmd = self.getSubHostCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
cmd = self.getEploadClientCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
cmd = self.getSubBackHostCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
||||||
cmd = self.getKillHTTPCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
@ -1,70 +0,0 @@
|
|||||||
from core.experience import Experience, ExperienceParameter
|
|
||||||
import os
|
|
||||||
|
|
||||||
class ExperienceIperf(Experience):
|
|
||||||
IPERF_LOG = "iperf.log"
|
|
||||||
SERVER_LOG = "server.log"
|
|
||||||
IPERF_BIN = "iperf3"
|
|
||||||
PING_OUTPUT = "ping.log"
|
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
|
||||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
|
||||||
self.loadParam()
|
|
||||||
self.ping()
|
|
||||||
Experience.classicRun(self)
|
|
||||||
|
|
||||||
def ping(self):
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceIperf.PING_OUTPUT)
|
|
||||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
|
||||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
|
||||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
|
||||||
self.mpConfig.getServerIP(), n = count)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
def pingCommand(self, fromIP, toIP, n=5):
|
|
||||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
|
||||||
" >> " + ExperienceIperf.PING_OUTPUT
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def loadParam(self):
|
|
||||||
"""
|
|
||||||
todo : param LD_PRELOAD ??
|
|
||||||
"""
|
|
||||||
self.time = self.xpParam.getParam(ExperienceParameter.IPERFTIME)
|
|
||||||
self.parallel = self.xpParam.getParam(ExperienceParameter.IPERFPARALLEL)
|
|
||||||
|
|
||||||
def prepare(self):
|
|
||||||
Experience.prepare(self)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " +
|
|
||||||
ExperienceIperf.IPERF_LOG)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " +
|
|
||||||
ExperienceIperf.SERVER_LOG)
|
|
||||||
|
|
||||||
def getClientCmd(self):
|
|
||||||
s = ExperienceIperf.IPERF_BIN + " -c " + self.mpConfig.getServerIP() + \
|
|
||||||
" -t " + self.time + " -P " + self.parallel + " &>" + ExperienceIperf.IPERF_LOG
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getServerCmd(self):
|
|
||||||
s = "sudo " + ExperienceIperf.IPERF_BIN + " -s &>" + \
|
|
||||||
ExperienceIperf.SERVER_LOG + "&"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
Experience.clean(self)
|
|
||||||
#todo use cst
|
|
||||||
#self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
cmd = self.getServerCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
||||||
cmd = self.getClientCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
@ -1,76 +0,0 @@
|
|||||||
from core.experience import Experience, ExperienceParameter
|
|
||||||
import os
|
|
||||||
|
|
||||||
class ExperienceMsg(Experience):
|
|
||||||
SERVER_LOG = "msg_server.log"
|
|
||||||
CLIENT_LOG = "msg_client.log"
|
|
||||||
CLIENT_ERR = "msg_client.err"
|
|
||||||
PING_OUTPUT = "ping.log"
|
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
|
||||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
|
||||||
self.loadParam()
|
|
||||||
self.ping()
|
|
||||||
Experience.classicRun(self)
|
|
||||||
|
|
||||||
def ping(self):
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceMsg.PING_OUTPUT )
|
|
||||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
|
||||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
|
||||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
|
||||||
self.mpConfig.getServerIP(), n = count)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
def pingCommand(self, fromIP, toIP, n=5):
|
|
||||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
|
||||||
" >> " + ExperienceMsg.PING_OUTPUT
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def loadParam(self):
|
|
||||||
"""
|
|
||||||
todo : param LD_PRELOAD ??
|
|
||||||
"""
|
|
||||||
self.client_sleep = self.xpParam.getParam(ExperienceParameter.MSGCLIENTSLEEP)
|
|
||||||
self.server_sleep = self.xpParam.getParam(ExperienceParameter.MSGSERVERSLEEP)
|
|
||||||
self.nb_requests = self.xpParam.getParam(ExperienceParameter.MSGNBREQUESTS)
|
|
||||||
self.bytes = self.xpParam.getParam(ExperienceParameter.MSGBYTES)
|
|
||||||
|
|
||||||
def prepare(self):
|
|
||||||
Experience.prepare(self)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceMsg.CLIENT_LOG)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
|
||||||
ExperienceMsg.SERVER_LOG)
|
|
||||||
|
|
||||||
def getMsgServerCmd(self):
|
|
||||||
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \
|
|
||||||
"/utils/msg_server.py --sleep " + self.server_sleep + " --bytes " + self.bytes + " &>" + ExperienceMsg.SERVER_LOG + "&"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getMsgClientCmd(self):
|
|
||||||
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \
|
|
||||||
"/utils/msg_client.py --sleep " + self.client_sleep + " --nb " + self.nb_requests + \
|
|
||||||
" --bytes " + self.bytes + " >" + ExperienceMsg.CLIENT_LOG + " 2>" + ExperienceMsg.CLIENT_ERR
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
Experience.clean(self)
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
cmd = self.getMsgServerCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
||||||
cmd = self.getMsgClientCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f msg_server.py")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
@ -1,78 +0,0 @@
|
|||||||
from core.experience import Experience, ExperienceParameter
|
|
||||||
|
|
||||||
"""
|
|
||||||
Should be the mother of ExperienceNCPV, shame on me, should rewrite
|
|
||||||
ExperienceNCPV as daughter class of this one.
|
|
||||||
"""
|
|
||||||
|
|
||||||
class ExperienceNC(Experience):
|
|
||||||
SERVER_NC_LOG = "netcat_server"
|
|
||||||
CLIENT_NC_LOG = "netcat_client"
|
|
||||||
NC_BIN = "netcat"
|
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
|
||||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
|
||||||
self.loadParam()
|
|
||||||
Experience.classicRun(self)
|
|
||||||
|
|
||||||
def loadParam(self):
|
|
||||||
self.ddibs = self.xpParam.getParam(ExperienceParameter.DDIBS)
|
|
||||||
self.ddobs = self.xpParam.getParam(ExperienceParameter.DDOBS)
|
|
||||||
self.ddcount = self.xpParam.getParam(ExperienceParameter.DDCOUNT)
|
|
||||||
self.ncServerPort = self.xpParam.getParam(ExperienceParameter.NCSERVERPORT)
|
|
||||||
self.ncClientPort = []
|
|
||||||
for k in sorted(self.xpParam.paramDic):
|
|
||||||
if k.startswith(ExperienceParameter.NCCLIENTPORT):
|
|
||||||
port = self.xpParam.paramDic[k]
|
|
||||||
self.ncClientPort.append(port)
|
|
||||||
if len(self.ncClientPort) == 0:
|
|
||||||
d = self.xpParam.getParam(ExperienceParameter.NCCLIENTPORT)
|
|
||||||
self.ncClientPort.append(d)
|
|
||||||
|
|
||||||
def prepare(self):
|
|
||||||
Experience.prepare(self)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceNC.CLIENT_NC_LOG )
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
|
||||||
ExperienceNC.SERVER_NC_LOG )
|
|
||||||
|
|
||||||
def getNCServerCmd(self, id):
|
|
||||||
s = "dd if=/dev/urandom ibs=" + self.ddibs + \
|
|
||||||
" obs=" + self.ddobs + \
|
|
||||||
" count=" + self.ddcount + \
|
|
||||||
" | " + \
|
|
||||||
ExperienceNC.NC_BIN + \
|
|
||||||
" -l " + self.ncServerPort + \
|
|
||||||
" &>" + ExperienceNC.SERVER_NC_LOG + \
|
|
||||||
"_" + str(id) + ".log"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getNCClientCmd(self, id):
|
|
||||||
s = ExperienceNC.NC_BIN + " " + \
|
|
||||||
" -p " + self.ncClientPort[id] + " " + \
|
|
||||||
self.mpConfig.getServerIP() + " " + \
|
|
||||||
self.ncServerPort + " " + \
|
|
||||||
"&>" + ExperienceNC.CLIENT_NC_LOG + \
|
|
||||||
"_" + str(id) + ".log"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
Experience.clean(self)
|
|
||||||
#todo use cst
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
for i in range(0, len(self.ncClientPort)):
|
|
||||||
cmd = self.getNCServerCmd(i)
|
|
||||||
self.mpConfig.server.sendCmd(cmd)
|
|
||||||
|
|
||||||
cmd = self.getNCClientCmd(i)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
self.mpConfig.server.waitOutput()
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 1")
|
|
||||||
|
|
@ -1,167 +0,0 @@
|
|||||||
from core.experience import Experience, ExperienceParameter
|
|
||||||
|
|
||||||
|
|
||||||
class MpPvAt(object):
|
|
||||||
def __init__(self, at, cmd):
|
|
||||||
self.at = at
|
|
||||||
self.cmd = cmd
|
|
||||||
self.delta = 0
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return "Pv... at " + str(self.at) + "(" + str(self.delta) + \
|
|
||||||
") will be " + self.cmd
|
|
||||||
|
|
||||||
|
|
||||||
class ExperienceNCPV(Experience):
|
|
||||||
"""
|
|
||||||
NC PV : NetCat and Pipe Viewer
|
|
||||||
"""
|
|
||||||
SERVER_NC_LOG = "netcat_server"
|
|
||||||
CLIENT_NC_LOG = "netcat_client"
|
|
||||||
NC_BIN = "/usr/local/bin/nc"
|
|
||||||
PV_BIN = "/usr/local/bin/pv"
|
|
||||||
PING_OUTPUT = "ping.log"
|
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
|
||||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
|
||||||
self.loadParam()
|
|
||||||
self.ping()
|
|
||||||
Experience.classicRun(self)
|
|
||||||
|
|
||||||
def ping(self):
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceNCPV.PING_OUTPUT )
|
|
||||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
|
||||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
|
||||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
|
||||||
self.mpConfig.getServerIP(), n = count)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
def pingCommand(self, fromIP, toIP, n=5):
|
|
||||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
|
||||||
" >> " + ExperienceNCPV.PING_OUTPUT
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def loadParam(self):
|
|
||||||
self.pvg = self.xpParam.getParam(ExperienceParameter.PVG)
|
|
||||||
self.pvz = self.xpParam.getParam(ExperienceParameter.PVZ)
|
|
||||||
self.pvRateLimit = self.xpParam.getParam(ExperienceParameter.PVRATELIMIT)
|
|
||||||
self.ddibs = self.xpParam.getParam(ExperienceParameter.DDIBS)
|
|
||||||
self.ddobs = self.xpParam.getParam(ExperienceParameter.DDOBS)
|
|
||||||
self.ddcount = self.xpParam.getParam(ExperienceParameter.DDCOUNT)
|
|
||||||
self.ncServerPort = self.xpParam.getParam(ExperienceParameter.NCSERVERPORT)
|
|
||||||
self.pvRateLimit = self.xpParam.getParam(ExperienceParameter.PVRATELIMIT)
|
|
||||||
self.ncClientPort = []
|
|
||||||
for k in sorted(self.xpParam.paramDic):
|
|
||||||
if k.startswith(ExperienceParameter.NCCLIENTPORT):
|
|
||||||
port = self.xpParam.paramDic[k]
|
|
||||||
self.ncClientPort.append(port)
|
|
||||||
if len(self.ncClientPort) == 0:
|
|
||||||
d = self.xpParam.getParam(ExperienceParameter.NCCLIENTPORT)
|
|
||||||
self.ncClientPort.append(d)
|
|
||||||
self.loadPvAt()
|
|
||||||
|
|
||||||
def loadPvAt(self):
|
|
||||||
self.changePvAt = []
|
|
||||||
self.changePv = self.xpParam.getParam(ExperienceParameter.CHANGEPV)
|
|
||||||
if self.changePv != "yes":
|
|
||||||
print("Don't change pv rate...")
|
|
||||||
return
|
|
||||||
changePvAt = self.xpParam.getParam(ExperienceParameter.CHANGEPVAT)
|
|
||||||
if not isinstance(changePvAt, list):
|
|
||||||
changePvAt = [changePvAt]
|
|
||||||
for p in changePvAt:
|
|
||||||
tab = p.split(",")
|
|
||||||
if len(tab)==2:
|
|
||||||
o = MpPvAt(float(tab[0]), tab[1])
|
|
||||||
self.addPvAt(o)
|
|
||||||
else:
|
|
||||||
print("pv wrong line : " + p)
|
|
||||||
|
|
||||||
def addPvAt(self, p):
|
|
||||||
if len(self.changePvAt) == 0 :
|
|
||||||
p.delta = p.at
|
|
||||||
else:
|
|
||||||
if p.at > self.changePvAt[-1].at:
|
|
||||||
p.delta = p.at - self.changePvAt[-1].at
|
|
||||||
else:
|
|
||||||
print("Do not take into account " + p.__str__() + \
|
|
||||||
"because ooo !")
|
|
||||||
return
|
|
||||||
|
|
||||||
self.changePvAt.append(p)
|
|
||||||
|
|
||||||
def getPvChangeCmd(self):
|
|
||||||
cmd = ""
|
|
||||||
for p in self.changePvAt:
|
|
||||||
cmd = cmd + "sleep " + str(p.delta)
|
|
||||||
cmd = cmd + " && "
|
|
||||||
cmd = cmd + ExperienceNCPV.PV_BIN + " -R " + self.pvPid
|
|
||||||
cmd = cmd + " " + p.cmd + " && "
|
|
||||||
cmd = cmd + " true &"
|
|
||||||
return cmd
|
|
||||||
|
|
||||||
def prepare(self):
|
|
||||||
Experience.prepare(self)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceNCPV.CLIENT_NC_LOG )
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
|
||||||
ExperienceNCPV.SERVER_NC_LOG )
|
|
||||||
|
|
||||||
def getNCServerCmd(self, id):
|
|
||||||
s = ExperienceNCPV.NC_BIN + " -d " + \
|
|
||||||
" -l " + self.ncServerPort + \
|
|
||||||
" 1>/dev/null 2>" + ExperienceNCPV.SERVER_NC_LOG + \
|
|
||||||
"_" + str(id) + ".log &"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getNCClientCmd(self, id):
|
|
||||||
s = "dd if=/dev/urandom ibs=" + self.ddibs + \
|
|
||||||
" obs=" + self.ddobs + \
|
|
||||||
" count=" + self.ddcount + \
|
|
||||||
" | " + ExperienceNCPV.PV_BIN + \
|
|
||||||
" -g " + self.pvg + " -z " + self.pvz + \
|
|
||||||
" -q --rate-limit " + self.pvRateLimit + \
|
|
||||||
" | " + ExperienceNCPV.NC_BIN + " " + \
|
|
||||||
" -p " + self.ncClientPort[id] + " " + \
|
|
||||||
self.mpConfig.getServerIP() + " " + \
|
|
||||||
self.ncServerPort + " " + \
|
|
||||||
"&>" + ExperienceNCPV.CLIENT_NC_LOG + \
|
|
||||||
"_" + str(id) + ".log"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
def getPvPidCmd(self):
|
|
||||||
s = "pgrep -n pv"
|
|
||||||
return s
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
Experience.clean(self)
|
|
||||||
#todo use cst
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
for i in range(0, len(self.ncClientPort)):
|
|
||||||
cmd = self.getNCServerCmd(i)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
|
|
||||||
cmd = self.getNCClientCmd(i)
|
|
||||||
self.mpConfig.client.sendCmd(cmd)
|
|
||||||
|
|
||||||
cmd = self.getPvPidCmd()
|
|
||||||
self.pvPid = None
|
|
||||||
while self.pvPid == None or self.pvPid == "":
|
|
||||||
self.pvPid = self.mpTopo.commandTo(self.mpConfig.server, cmd)[:-1]
|
|
||||||
print("guessing pv pid ... :" + str(self.pvPid))
|
|
||||||
|
|
||||||
cmd = self.getPvChangeCmd()
|
|
||||||
print(cmd)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
|
|
||||||
|
|
||||||
self.mpConfig.client.waitOutput()
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 1")
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
|||||||
from core.experience import Experience, ExperienceParameter
|
|
||||||
import os
|
|
||||||
|
|
||||||
class ExperienceNetperf(Experience):
|
|
||||||
NETPERF_LOG = "netperf.log"
|
|
||||||
NETSERVER_LOG = "netserver.log"
|
|
||||||
NETPERF_BIN = "netperf"
|
|
||||||
NETSERVER_BIN = "netserver"
|
|
||||||
PING_OUTPUT = "ping.log"
|
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
|
||||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
|
||||||
self.loadParam()
|
|
||||||
self.ping()
|
|
||||||
Experience.classicRun(self)
|
|
||||||
|
|
||||||
def ping(self):
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceNetperf.PING_OUTPUT)
|
|
||||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
|
||||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
|
||||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
|
||||||
self.mpConfig.getServerIP(), n = count)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
def pingCommand(self, fromIP, toIP, n=5):
|
|
||||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
|
||||||
" >> " + ExperienceNetperf.PING_OUTPUT
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def loadParam(self):
|
|
||||||
"""
|
|
||||||
todo : param LD_PRELOAD ??
|
|
||||||
"""
|
|
||||||
self.testlen = self.xpParam.getParam(ExperienceParameter.NETPERFTESTLEN)
|
|
||||||
self.testname = self.xpParam.getParam(ExperienceParameter.NETPERFTESTNAME)
|
|
||||||
self.reqres_size = self.xpParam.getParam(ExperienceParameter.NETPERFREQRESSIZE)
|
|
||||||
|
|
||||||
def prepare(self):
|
|
||||||
Experience.prepare(self)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " +
|
|
||||||
ExperienceNetperf.NETPERF_LOG)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " +
|
|
||||||
ExperienceNetperf.NETSERVER_LOG)
|
|
||||||
|
|
||||||
def getClientCmd(self):
|
|
||||||
s = ExperienceNetperf.NETPERF_BIN + " -H " + self.mpConfig.getServerIP() + \
|
|
||||||
" -l " + self.testlen + " -t " + self.testname + " -- -r " + self.reqres_size + \
|
|
||||||
" &>" + ExperienceNetperf.NETPERF_LOG
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getServerCmd(self):
|
|
||||||
s = "sudo " + ExperienceNetperf.NETSERVER_BIN + " &>" + \
|
|
||||||
ExperienceNetperf.NETSERVER_LOG + "&"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
Experience.clean(self)
|
|
||||||
#todo use cst
|
|
||||||
#self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
cmd = self.getServerCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
||||||
cmd = self.getClientCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
@ -1,132 +0,0 @@
|
|||||||
from core.experience import Experience, ExperienceParameter
|
|
||||||
from topos.multi_interface_cong import MultiInterfaceCongConfig
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
class ExperienceQUIC(Experience):
|
|
||||||
GO_BIN = "/usr/local/go/bin/go"
|
|
||||||
WGET = "~/git/wget/src/wget"
|
|
||||||
SERVER_LOG = "quic_server.log"
|
|
||||||
CLIENT_LOG = "quic_client.log"
|
|
||||||
CLIENT_GO_FILE = "~/go/src/github.com/lucas-clemente/quic-go/example/client_benchmarker_cached/main.go"
|
|
||||||
SERVER_GO_FILE = "~/go/src/github.com/lucas-clemente/quic-go/example/main.go"
|
|
||||||
CERTPATH = "~/go/src/github.com/lucas-clemente/quic-go/example/"
|
|
||||||
PING_OUTPUT = "ping.log"
|
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
|
||||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
|
||||||
self.loadParam()
|
|
||||||
self.ping()
|
|
||||||
Experience.classicRun(self)
|
|
||||||
|
|
||||||
def ping(self):
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceQUIC.PING_OUTPUT )
|
|
||||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
|
||||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
|
||||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
|
||||||
self.mpConfig.getServerIP(), n = count)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
def pingCommand(self, fromIP, toIP, n=5):
|
|
||||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
|
||||||
" >> " + ExperienceQUIC.PING_OUTPUT
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def loadParam(self):
|
|
||||||
"""
|
|
||||||
todo : param LD_PRELOAD ??
|
|
||||||
"""
|
|
||||||
self.file = self.xpParam.getParam(ExperienceParameter.HTTPSFILE)
|
|
||||||
self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPSRANDOMSIZE)
|
|
||||||
self.multipath = self.xpParam.getParam(ExperienceParameter.QUICMULTIPATH)
|
|
||||||
|
|
||||||
def prepare(self):
|
|
||||||
Experience.prepare(self)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceQUIC.CLIENT_LOG )
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
|
||||||
ExperienceQUIC.SERVER_LOG )
|
|
||||||
if self.file == "random":
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client,
|
|
||||||
"dd if=/dev/urandom of=random bs=1K count=" + \
|
|
||||||
self.random_size)
|
|
||||||
|
|
||||||
def getQUICServerCmd(self):
|
|
||||||
s = ExperienceQUIC.GO_BIN + " run " + ExperienceQUIC.SERVER_GO_FILE
|
|
||||||
s += " -www . -certpath " + ExperienceQUIC.CERTPATH + " &>"
|
|
||||||
s += ExperienceQUIC.SERVER_LOG + " &"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getQUICClientCmd(self):
|
|
||||||
s = ExperienceQUIC.GO_BIN + " run " + ExperienceQUIC.CLIENT_GO_FILE
|
|
||||||
if int(self.multipath) > 0:
|
|
||||||
s += " -m"
|
|
||||||
s += " https://" + self.mpConfig.getServerIP() + ":6121/random &>" + ExperienceQUIC.CLIENT_LOG
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getCongServerCmd(self, congID):
|
|
||||||
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \
|
|
||||||
"/utils/https_server.py &> https_server" + str(congID) + ".log &"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getCongClientCmd(self, congID):
|
|
||||||
s = "(time " + ExperienceQUIC.WGET + " https://" + self.mpConfig.getCongServerIP(congID) +\
|
|
||||||
"/" + self.file + " --no-check-certificate --disable-mptcp) &> https_client" + str(congID) + ".log &"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
Experience.clean(self)
|
|
||||||
if self.file == "random":
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
|
||||||
#todo use cst
|
|
||||||
#self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
cmd = self.getQUICServerCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
|
|
||||||
if isinstance(self.mpConfig, MultiInterfaceCongConfig):
|
|
||||||
i = 0
|
|
||||||
for cs in self.mpConfig.cong_servers:
|
|
||||||
cmd = self.getCongServerCmd(i)
|
|
||||||
self.mpTopo.commandTo(cs, cmd)
|
|
||||||
i = i + 1
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before")
|
|
||||||
# First run congestion clients, then the main one
|
|
||||||
if isinstance(self.mpConfig, MultiInterfaceCongConfig):
|
|
||||||
i = 0
|
|
||||||
for cc in self.mpConfig.cong_clients:
|
|
||||||
cmd = self.getCongClientCmd(i)
|
|
||||||
self.mpTopo.commandTo(cc, cmd)
|
|
||||||
i = i + 1
|
|
||||||
|
|
||||||
cmd = self.getQUICClientCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after")
|
|
||||||
# Wait for congestion traffic to end
|
|
||||||
if isinstance(self.mpConfig, MultiInterfaceCongConfig):
|
|
||||||
for cc in self.mpConfig.cong_clients:
|
|
||||||
self.mpTopo.commandTo(cc, "while pkill -f wget -0; do sleep 0.5; done")
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f " + ExperienceQUIC.SERVER_GO_FILE)
|
|
||||||
if isinstance(self.mpConfig, MultiInterfaceCongConfig):
|
|
||||||
for cs in self.mpConfig.cong_servers:
|
|
||||||
self.mpTopo.commandTo(cs, "pkill -f https_server.py")
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
||||||
# Need to delete the go-build directory in tmp; could lead to no more space left error
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm -r /tmp/go-build*")
|
|
||||||
# Remove cache data
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm cache_*")
|
|
@ -1,81 +0,0 @@
|
|||||||
from core.experience import Experience, ExperienceParameter
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
class ExperienceQUICSiri(Experience):
|
|
||||||
GO_BIN = "/usr/local/go/bin/go"
|
|
||||||
SERVER_LOG = "quic_server.log"
|
|
||||||
CLIENT_LOG = "quic_client.log"
|
|
||||||
CLIENT_GO_FILE = "~/go/src/github.com/lucas-clemente/quic-go/example/siri/client/siri.go"
|
|
||||||
SERVER_GO_FILE = "~/go/src/github.com/lucas-clemente/quic-go/example/siri/siri.go"
|
|
||||||
PING_OUTPUT = "ping.log"
|
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
|
||||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
|
||||||
self.loadParam()
|
|
||||||
self.ping()
|
|
||||||
Experience.classicRun(self)
|
|
||||||
|
|
||||||
def ping(self):
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceQUICSiri.PING_OUTPUT )
|
|
||||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
|
||||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
|
||||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
|
||||||
self.mpConfig.getServerIP(), n = count)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
def pingCommand(self, fromIP, toIP, n=5):
|
|
||||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
|
||||||
" >> " + ExperienceQUICSiri.PING_OUTPUT
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def loadParam(self):
|
|
||||||
"""
|
|
||||||
todo : param LD_PRELOAD ??
|
|
||||||
"""
|
|
||||||
self.run_time = self.xpParam.getParam(ExperienceParameter.QUICSIRIRUNTIME)
|
|
||||||
self.multipath = self.xpParam.getParam(ExperienceParameter.QUICMULTIPATH)
|
|
||||||
|
|
||||||
def prepare(self):
|
|
||||||
Experience.prepare(self)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceQUICSiri.CLIENT_LOG )
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
|
||||||
ExperienceQUICSiri.SERVER_LOG )
|
|
||||||
|
|
||||||
def getQUICSiriServerCmd(self):
|
|
||||||
s = ExperienceQUICSiri.GO_BIN + " run " + ExperienceQUICSiri.SERVER_GO_FILE
|
|
||||||
s += " -addr 0.0.0.0:8080 &>" + ExperienceQUICSiri.SERVER_LOG + " &"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getQUICSiriClientCmd(self):
|
|
||||||
s = ExperienceQUICSiri.GO_BIN + " run " + ExperienceQUICSiri.CLIENT_GO_FILE
|
|
||||||
s += " -addr " + self.mpConfig.getServerIP() + ":8080 -runTime " + self.run_time + "s"
|
|
||||||
if int(self.multipath) > 0:
|
|
||||||
s += " -m"
|
|
||||||
s += " &>" + ExperienceQUICSiri.CLIENT_LOG
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
Experience.clean(self)
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
cmd = self.getQUICSiriServerCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
||||||
cmd = self.getQUICSiriClientCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f " + ExperienceQUICSiri.SERVER_GO_FILE)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
||||||
# Need to delete the go-build directory in tmp; could lead to no more space left error
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm -r /tmp/go-build*")
|
|
@ -1,74 +0,0 @@
|
|||||||
from core.experience import Experience, ExperienceParameter
|
|
||||||
import os
|
|
||||||
|
|
||||||
class ExperienceSendFile(Experience):
|
|
||||||
SERVER_LOG = "sendfile_server.log"
|
|
||||||
CLIENT_LOG = "sendfile_client.log"
|
|
||||||
WGET_BIN = "./client"
|
|
||||||
PING_OUTPUT = "ping.log"
|
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
|
||||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
|
||||||
self.loadParam()
|
|
||||||
self.ping()
|
|
||||||
Experience.classicRun(self)
|
|
||||||
|
|
||||||
def ping(self):
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceSendFile.PING_OUTPUT )
|
|
||||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
|
||||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
|
||||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
|
||||||
self.mpConfig.getServerIP(), n = count)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
def pingCommand(self, fromIP, toIP, n=5):
|
|
||||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
|
||||||
" >> " + ExperienceSendFile.PING_OUTPUT
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def loadParam(self):
|
|
||||||
"""
|
|
||||||
todo : param LD_PRELOAD ??
|
|
||||||
"""
|
|
||||||
self.file = self.xpParam.getParam(ExperienceParameter.HTTPSFILE)
|
|
||||||
self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPSRANDOMSIZE)
|
|
||||||
|
|
||||||
def prepare(self):
|
|
||||||
Experience.prepare(self)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceSendFile.CLIENT_LOG )
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
|
||||||
ExperienceSendFile.SERVER_LOG )
|
|
||||||
if self.file == "random":
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client,
|
|
||||||
"dd if=/dev/urandom of=random bs=1K count=" + \
|
|
||||||
self.random_size)
|
|
||||||
|
|
||||||
def getSendFileServerCmd(self):
|
|
||||||
s = "./server &>" + ExperienceSendFile.SERVER_LOG + "&"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getSendFileClientCmd(self):
|
|
||||||
s = ExperienceSendFile.WGET_BIN + " " + self.mpConfig.getServerIP() + " &>" + ExperienceSendFile.CLIENT_LOG
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
Experience.clean(self)
|
|
||||||
if self.file == "random":
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
|
||||||
#todo use cst
|
|
||||||
#self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
cmd = self.getSendFileServerCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 0.1")
|
|
||||||
cmd = self.getSendFileClientCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
@ -1,85 +0,0 @@
|
|||||||
from core.experience import Experience, ExperienceParameter
|
|
||||||
import os
|
|
||||||
|
|
||||||
class ExperienceSiri(Experience):
|
|
||||||
SERVER_LOG = "siri_server.log"
|
|
||||||
CLIENT_LOG = "siri_client.log"
|
|
||||||
CLIENT_ERR = "siri_client.err"
|
|
||||||
JAVA_BIN = "java"
|
|
||||||
PING_OUTPUT = "ping.log"
|
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
|
||||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
|
||||||
self.loadParam()
|
|
||||||
self.ping()
|
|
||||||
Experience.classicRun(self)
|
|
||||||
|
|
||||||
def ping(self):
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceSiri.PING_OUTPUT )
|
|
||||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
|
||||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
|
||||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
|
||||||
self.mpConfig.getServerIP(), n = count)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
def pingCommand(self, fromIP, toIP, n=5):
|
|
||||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
|
||||||
" >> " + ExperienceSiri.PING_OUTPUT
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def loadParam(self):
|
|
||||||
"""
|
|
||||||
todo : param LD_PRELOAD ??
|
|
||||||
"""
|
|
||||||
self.run_time = self.xpParam.getParam(ExperienceParameter.SIRIRUNTIME)
|
|
||||||
self.query_size = self.xpParam.getParam(ExperienceParameter.SIRIQUERYSIZE)
|
|
||||||
self.response_size = self.xpParam.getParam(ExperienceParameter.SIRIRESPONSESIZE)
|
|
||||||
self.delay_query_response = self.xpParam.getParam(ExperienceParameter.SIRIDELAYQUERYRESPONSE)
|
|
||||||
self.min_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMINPAYLOADSIZE)
|
|
||||||
self.max_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMAXPAYLOADSIZE)
|
|
||||||
self.interval_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALTIMEMS)
|
|
||||||
self.buffer_size = self.xpParam.getParam(ExperienceParameter.SIRIBUFFERSIZE)
|
|
||||||
self.burst_size = self.xpParam.getParam(ExperienceParameter.SIRIBURSTSIZE)
|
|
||||||
self.interval_burst_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALBURSTTIMEMS)
|
|
||||||
|
|
||||||
def prepare(self):
|
|
||||||
Experience.prepare(self)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceSiri.CLIENT_LOG)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
|
||||||
ExperienceSiri.SERVER_LOG)
|
|
||||||
|
|
||||||
def getSiriServerCmd(self):
|
|
||||||
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
|
||||||
"/utils/siri_server.py &>" + ExperienceSiri.SERVER_LOG + "&"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getSiriClientCmd(self):
|
|
||||||
s = ExperienceSiri.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/utils/siriClient.jar " + \
|
|
||||||
self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
|
|
||||||
" " + self.delay_query_response + " " + self.min_payload_size + " " + \
|
|
||||||
self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + " " + self.burst_size + " " + self.interval_burst_time_ms + \
|
|
||||||
" >" + ExperienceSiri.CLIENT_LOG + " 2>" + ExperienceSiri.CLIENT_ERR
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
Experience.clean(self)
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
cmd = self.getSiriServerCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
||||||
cmd = self.getSiriClientCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f siri_server.py")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
@ -1,116 +0,0 @@
|
|||||||
from core.experience import Experience, ExperienceParameter
|
|
||||||
import os
|
|
||||||
|
|
||||||
class ExperienceSiriHTTP(Experience):
|
|
||||||
HTTP_SERVER_LOG = "http_server.log"
|
|
||||||
HTTP_CLIENT_LOG = "http_client.log"
|
|
||||||
WGET_BIN = "wget"
|
|
||||||
SERVER_LOG = "siri_server.log"
|
|
||||||
CLIENT_LOG = "siri_client.log"
|
|
||||||
CLIENT_ERR = "siri_client.err"
|
|
||||||
JAVA_BIN = "java"
|
|
||||||
PING_OUTPUT = "ping.log"
|
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
|
||||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
|
||||||
self.loadParam()
|
|
||||||
self.ping()
|
|
||||||
Experience.classicRun(self)
|
|
||||||
|
|
||||||
def ping(self):
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceSiriHTTP.PING_OUTPUT )
|
|
||||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
|
||||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
|
||||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
|
||||||
self.mpConfig.getServerIP(), n = count)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
def pingCommand(self, fromIP, toIP, n=5):
|
|
||||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
|
||||||
" >> " + ExperienceSiriHTTP.PING_OUTPUT
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def loadParam(self):
|
|
||||||
"""
|
|
||||||
todo : param LD_PRELOAD ??
|
|
||||||
"""
|
|
||||||
self.run_time = self.xpParam.getParam(ExperienceParameter.SIRIRUNTIME)
|
|
||||||
self.query_size = self.xpParam.getParam(ExperienceParameter.SIRIQUERYSIZE)
|
|
||||||
self.response_size = self.xpParam.getParam(ExperienceParameter.SIRIRESPONSESIZE)
|
|
||||||
self.delay_query_response = self.xpParam.getParam(ExperienceParameter.SIRIDELAYQUERYRESPONSE)
|
|
||||||
self.min_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMINPAYLOADSIZE)
|
|
||||||
self.max_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMAXPAYLOADSIZE)
|
|
||||||
self.interval_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALTIMEMS)
|
|
||||||
self.buffer_size = self.xpParam.getParam(ExperienceParameter.SIRIBUFFERSIZE)
|
|
||||||
self.burst_size = self.xpParam.getParam(ExperienceParameter.SIRIBURSTSIZE)
|
|
||||||
self.interval_burst_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALBURSTTIMEMS)
|
|
||||||
self.file = self.xpParam.getParam(ExperienceParameter.HTTPFILE)
|
|
||||||
self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPRANDOMSIZE)
|
|
||||||
|
|
||||||
def prepare(self):
|
|
||||||
Experience.prepare(self)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceSiriHTTP.CLIENT_LOG)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
|
||||||
ExperienceSiriHTTP.SERVER_LOG)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceSiriHTTP.HTTP_CLIENT_LOG)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
|
||||||
ExperienceSiriHTTP.HTTP_SERVER_LOG)
|
|
||||||
if self.file == "random":
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client,
|
|
||||||
"dd if=/dev/urandom of=random bs=1K count=" + \
|
|
||||||
self.random_size)
|
|
||||||
|
|
||||||
|
|
||||||
def getSiriServerCmd(self):
|
|
||||||
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
|
||||||
"/utils/siri_server.py &>" + ExperienceSiriHTTP.SERVER_LOG + "&"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getSiriClientCmd(self):
|
|
||||||
s = ExperienceSiriHTTP.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/utils/siriClient.jar " + \
|
|
||||||
self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
|
|
||||||
" " + self.delay_query_response + " " + self.min_payload_size + " " + \
|
|
||||||
self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + " " + self.burst_size + " " + self.interval_burst_time_ms + \
|
|
||||||
" >" + ExperienceSiriHTTP.CLIENT_LOG + " 2>" + ExperienceSiriHTTP.CLIENT_ERR
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getHTTPServerCmd(self):
|
|
||||||
s = "/etc/init.d/apache2 restart &>" + ExperienceSiriHTTP.SERVER_LOG + "&"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getHTTPClientCmd(self):
|
|
||||||
s = ExperienceSiriHTTP.WGET_BIN + " http://" + self.mpConfig.getServerIP() + \
|
|
||||||
"/" + self.file + " --no-check-certificate"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
Experience.clean(self)
|
|
||||||
if self.file == "random":
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
cmd = self.getSiriServerCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
cmd = self.getHTTPServerCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before")
|
|
||||||
cmd = self.getHTTPClientCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "for i in {1..200}; do " + cmd + "; done &")
|
|
||||||
cmd = self.getSiriClientCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f siri_server.py")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
@ -1,118 +0,0 @@
|
|||||||
from core.experience import Experience, ExperienceParameter
|
|
||||||
import os
|
|
||||||
|
|
||||||
class ExperienceSiriMsg(Experience):
|
|
||||||
MSG_SERVER_LOG = "msg_server.log"
|
|
||||||
MSG_CLIENT_LOG = "msg_client.log"
|
|
||||||
MSG_CLIENT_ERR = "msg_client.err"
|
|
||||||
SERVER_LOG = "siri_server.log"
|
|
||||||
CLIENT_LOG = "siri_client.log"
|
|
||||||
CLIENT_ERR = "siri_client.err"
|
|
||||||
JAVA_BIN = "java"
|
|
||||||
PING_OUTPUT = "ping.log"
|
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
|
||||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
|
||||||
self.loadParam()
|
|
||||||
self.ping()
|
|
||||||
Experience.classicRun(self)
|
|
||||||
|
|
||||||
def ping(self):
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceSiriMsg.PING_OUTPUT )
|
|
||||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
|
||||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
|
||||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
|
||||||
self.mpConfig.getServerIP(), n = count)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
def pingCommand(self, fromIP, toIP, n=5):
|
|
||||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
|
||||||
" >> " + ExperienceSiriMsg.PING_OUTPUT
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def loadParam(self):
|
|
||||||
"""
|
|
||||||
todo : param LD_PRELOAD ??
|
|
||||||
"""
|
|
||||||
self.run_time = self.xpParam.getParam(ExperienceParameter.SIRIRUNTIME)
|
|
||||||
self.query_size = self.xpParam.getParam(ExperienceParameter.SIRIQUERYSIZE)
|
|
||||||
self.response_size = self.xpParam.getParam(ExperienceParameter.SIRIRESPONSESIZE)
|
|
||||||
self.delay_query_response = self.xpParam.getParam(ExperienceParameter.SIRIDELAYQUERYRESPONSE)
|
|
||||||
self.min_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMINPAYLOADSIZE)
|
|
||||||
self.max_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMAXPAYLOADSIZE)
|
|
||||||
self.interval_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALTIMEMS)
|
|
||||||
self.buffer_size = self.xpParam.getParam(ExperienceParameter.SIRIBUFFERSIZE)
|
|
||||||
self.burst_size = self.xpParam.getParam(ExperienceParameter.SIRIBURSTSIZE)
|
|
||||||
self.interval_burst_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALBURSTTIMEMS)
|
|
||||||
self.client_sleep = self.xpParam.getParam(ExperienceParameter.MSGCLIENTSLEEP)
|
|
||||||
self.server_sleep = self.xpParam.getParam(ExperienceParameter.MSGSERVERSLEEP)
|
|
||||||
self.nb_requests = self.xpParam.getParam(ExperienceParameter.MSGNBREQUESTS)
|
|
||||||
|
|
||||||
def prepare(self):
|
|
||||||
Experience.prepare(self)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceSiriMsg.CLIENT_LOG)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceSiriMsg.CLIENT_ERR)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
|
||||||
ExperienceSiriMsg.SERVER_LOG)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceSiriMsg.MSG_CLIENT_LOG)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceSiriMsg.MSG_CLIENT_ERR)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
|
||||||
ExperienceSiriMsg.MSG_SERVER_LOG)
|
|
||||||
|
|
||||||
def getSiriServerCmd(self):
|
|
||||||
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
|
||||||
"/utils/siri_server.py &>" + ExperienceSiriMsg.SERVER_LOG + "&"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getSiriClientCmd(self):
|
|
||||||
s = ExperienceSiriMsg.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/utils/siriClient.jar " + \
|
|
||||||
self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
|
|
||||||
" " + self.delay_query_response + " " + self.min_payload_size + " " + \
|
|
||||||
self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + " " + self.burst_size + " " + self.interval_burst_time_ms + \
|
|
||||||
" >" + ExperienceSiriMsg.CLIENT_LOG + " 2>" + ExperienceSiriMsg.CLIENT_ERR
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getMsgServerCmd(self):
|
|
||||||
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
|
||||||
"/utils/msg_server.py --sleep " + self.server_sleep + " &>" + ExperienceSiriMsg.MSG_SERVER_LOG + "&"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getMsgClientCmd(self):
|
|
||||||
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \
|
|
||||||
"/utils/msg_client.py --sleep " + self.client_sleep + " --nb " + self.nb_requests + \
|
|
||||||
" --bulk >" + ExperienceSiriMsg.MSG_CLIENT_LOG + " 2>" + ExperienceSiriMsg.MSG_CLIENT_ERR + "&"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
Experience.clean(self)
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
cmd = self.getSiriServerCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
cmd = self.getMsgServerCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before")
|
|
||||||
cmd = self.getMsgClientCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
cmd = self.getSiriClientCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f siri_server.py")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f msg_server.py")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f msg_client.py")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
@ -1,89 +0,0 @@
|
|||||||
from core.experience import Experience, ExperienceParameter
|
|
||||||
import os
|
|
||||||
|
|
||||||
class ExperienceVLC(Experience):
|
|
||||||
SERVER_LOG = "vlc_server.log"
|
|
||||||
CLIENT_LOG = "vlc_client.log"
|
|
||||||
VLC_BIN = "/home/mininet/vlc/vlc"
|
|
||||||
PING_OUTPUT = "ping.log"
|
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
|
||||||
Experience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
|
||||||
self.loadParam()
|
|
||||||
self.ping()
|
|
||||||
Experience.classicRun(self)
|
|
||||||
|
|
||||||
def ping(self):
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceVLC.PING_OUTPUT )
|
|
||||||
count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT)
|
|
||||||
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
|
||||||
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
|
||||||
self.mpConfig.getServerIP(), n = count)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
def pingCommand(self, fromIP, toIP, n=5):
|
|
||||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
|
||||||
" >> " + ExperienceVLC.PING_OUTPUT
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def loadParam(self):
|
|
||||||
"""
|
|
||||||
todo : param LD_PRELOAD ??
|
|
||||||
"""
|
|
||||||
self.file = self.xpParam.getParam(ExperienceParameter.VLCFILE)
|
|
||||||
self.time = self.xpParam.getParam(ExperienceParameter.VLCTIME)
|
|
||||||
# todo
|
|
||||||
# self.random_size = self.xpParam.getParam(ExperienceParameter.VLCRANDOMSIZE)
|
|
||||||
|
|
||||||
def prepare(self):
|
|
||||||
Experience.prepare(self)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
||||||
ExperienceVLC.CLIENT_LOG )
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "Xvfb :66 &")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
|
||||||
ExperienceVLC.SERVER_LOG )
|
|
||||||
if self.file == "random":
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client,
|
|
||||||
"dd if=/dev/urandom of=random bs=1K count=" + \
|
|
||||||
self.random_size)
|
|
||||||
|
|
||||||
def getVLCServerCmd(self):
|
|
||||||
s = "/etc/init.d/apache2 restart &>" + ExperienceVLC.SERVER_LOG + " "
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def getVLCClientCmd(self):
|
|
||||||
s = "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/mininet/usr/lib/ && sudo ldconfig && " \
|
|
||||||
+ ExperienceVLC.VLC_BIN + " -I dummy --x11-display :66" + \
|
|
||||||
" --adaptive-logic 3 --no-loop --play-and-exit " + \
|
|
||||||
" http://" + self.mpConfig.getServerIP() + \
|
|
||||||
"/" + self.file + " 2>&1 | grep -E '(Neb|halp|bandwidth|late|Buffering|buffering)' > " + ExperienceVLC.CLIENT_LOG
|
|
||||||
if self.time != "0" :
|
|
||||||
s = s + " &"
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
Experience.clean(self)
|
|
||||||
if self.file == "random":
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "pkill Xvfb")
|
|
||||||
#todo use cst
|
|
||||||
#self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
cmd = self.getVLCServerCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 1")
|
|
||||||
cmd = self.getVLCClientCmd()
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
|
||||||
|
|
||||||
if self.time != "0" :
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep " + self.time)
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "pkill -9 -f vlc")
|
|
||||||
|
|
||||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
|
132
mpXpRunner.py
132
mpXpRunner.py
@ -3,103 +3,55 @@ from core.topo import Topo, TopoParameter
|
|||||||
|
|
||||||
from mininet_builder import MininetBuilder
|
from mininet_builder import MininetBuilder
|
||||||
|
|
||||||
from topos import TOPO_CONFIGS, TOPOS
|
|
||||||
from experiences import EXPERIENCES
|
from experiences import EXPERIENCES
|
||||||
|
from topos import TOPO_CONFIGS, TOPOS
|
||||||
from mpExperienceNCPV import ExperienceNCPV
|
|
||||||
from mpExperienceNC import ExperienceNC
|
|
||||||
from mpExperienceSendFile import ExperienceSendFile
|
|
||||||
from mpExperienceEpload import ExperienceEpload
|
|
||||||
from mpExperienceNetperf import ExperienceNetperf
|
|
||||||
from mpExperienceSiri import ExperienceSiri
|
|
||||||
from mpExperienceVLC import ExperienceVLC
|
|
||||||
from mpExperienceIperf import ExperienceIperf
|
|
||||||
from mpExperienceMsg import ExperienceMsg
|
|
||||||
from mpExperienceSiriHTTP import ExperienceSiriHTTP
|
|
||||||
from mpExperienceSiriMsg import ExperienceSiriMsg
|
|
||||||
from mpExperienceQUIC import ExperienceQUIC
|
|
||||||
from mpExperienceQUICSiri import ExperienceQUICSiri
|
|
||||||
|
|
||||||
|
|
||||||
class MpXpRunner:
|
class MpXpRunner:
|
||||||
def __init__(self, builderType, topoParamFile, xpParamFile):
|
def __init__(self, builderType, topoParamFile, xpParamFile):
|
||||||
self.defParamXp(xpParamFile)
|
self.defParamXp(xpParamFile)
|
||||||
self.topoParam = TopoParameter(topoParamFile)
|
self.topoParam = TopoParameter(topoParamFile)
|
||||||
self.defBuilder(builderType)
|
self.defBuilder(builderType)
|
||||||
self.defTopo()
|
self.defTopo()
|
||||||
self.defConfig()
|
self.defConfig()
|
||||||
self.startTopo()
|
self.startTopo()
|
||||||
self.runXp()
|
self.runXp()
|
||||||
self.stopTopo()
|
self.stopTopo()
|
||||||
|
|
||||||
def defParamXp(self, xpParamFile):
|
def defParamXp(self, xpParamFile):
|
||||||
self.xpParam = ExperienceParameter(xpParamFile)
|
self.xpParam = ExperienceParameter(xpParamFile)
|
||||||
|
|
||||||
def defBuilder(self, builderType):
|
def defBuilder(self, builderType):
|
||||||
if builderType == Topo.mininetBuilder:
|
if builderType == Topo.mininetBuilder:
|
||||||
self.topoBuilder = MininetBuilder()
|
self.topoBuilder = MininetBuilder()
|
||||||
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(Topo.topoAttr)
|
t = self.topoParam.getParam(Topo.topoAttr)
|
||||||
if t in TOPOS:
|
if t in TOPOS:
|
||||||
self.Topo = TOPOS[t](self.topoBuilder, self.topoParam)
|
self.Topo = TOPOS[t](self.topoBuilder, self.topoParam)
|
||||||
else:
|
else:
|
||||||
raise Exception("Unknown topo: {}".format(t))
|
raise Exception("Unknown topo: {}".format(t))
|
||||||
print(self.Topo)
|
print(self.Topo)
|
||||||
|
|
||||||
def defConfig(self):
|
def defConfig(self):
|
||||||
t = self.topoParam.getParam(Topo.topoAttr)
|
t = self.topoParam.getParam(Topo.topoAttr)
|
||||||
if t in TOPO_CONFIGS:
|
if t in TOPO_CONFIGS:
|
||||||
self.TopoConfig = TOPO_CONFIGS[t](self.Topo, self.topoParam)
|
self.TopoConfig = TOPO_CONFIGS[t](self.Topo, self.topoParam)
|
||||||
else:
|
else:
|
||||||
raise Exception("Unknown topo config: {}".format(t))
|
raise Exception("Unknown topo config: {}".format(t))
|
||||||
|
|
||||||
def startTopo(self):
|
def startTopo(self):
|
||||||
self.Topo.startNetwork()
|
self.Topo.startNetwork()
|
||||||
self.TopoConfig.configureNetwork()
|
self.TopoConfig.configureNetwork()
|
||||||
|
|
||||||
def runXp(self):
|
def runXp(self):
|
||||||
xp = self.xpParam.getParam(ExperienceParameter.XPTYPE)
|
xp = self.xpParam.getParam(ExperienceParameter.XPTYPE)
|
||||||
if xp in EXPERIENCES:
|
if xp in EXPERIENCES:
|
||||||
EXPERIENCES[xp](self.xpParam, self.Topo, self.TopoConfig)
|
EXPERIENCES[xp](self.xpParam, self.Topo, self.TopoConfig)
|
||||||
elif xp ==Experience.NCPV:
|
else:
|
||||||
ExperienceNCPV(self.xpParam, self.Topo,
|
raise Exception("Unknown experience {}".format(xp))
|
||||||
self.TopoConfig)
|
|
||||||
elif xp ==Experience.NC:
|
|
||||||
ExperienceNC(self.xpParam, self.Topo,
|
|
||||||
self.TopoConfig)
|
|
||||||
elif xp ==Experience.EPLOAD:
|
|
||||||
ExperienceEpload(self.xpParam, self.Topo,
|
|
||||||
self.TopoConfig)
|
|
||||||
elif xp ==Experience.NETPERF:
|
|
||||||
ExperienceNetperf(self.xpParam, self.Topo,
|
|
||||||
self.TopoConfig)
|
|
||||||
elif xp ==Experience.SIRI:
|
|
||||||
ExperienceSiri(self.xpParam, self.Topo,
|
|
||||||
self.TopoConfig)
|
|
||||||
elif xp ==Experience.SENDFILE:
|
|
||||||
ExperienceSendFile(self.xpParam, self.Topo,
|
|
||||||
self.TopoConfig)
|
|
||||||
elif xp ==Experience.VLC:
|
|
||||||
ExperienceVLC(self.xpParam, self.Topo,
|
|
||||||
self.TopoConfig)
|
|
||||||
elif xp ==Experience.IPERF:
|
|
||||||
ExperienceIperf(self.xpParam, self.Topo,
|
|
||||||
self.TopoConfig)
|
|
||||||
elif xp ==Experience.MSG:
|
|
||||||
ExperienceMsg(self.xpParam, self.Topo, self.TopoConfig)
|
|
||||||
elif xp ==Experience.SIRIHTTP:
|
|
||||||
ExperienceSiriHTTP(self.xpParam, self.Topo, self.TopoConfig)
|
|
||||||
elif xp ==Experience.SIRIMSG:
|
|
||||||
ExperienceSiriMsg(self.xpParam, self.Topo, self.TopoConfig)
|
|
||||||
elif xp ==Experience.QUIC:
|
|
||||||
ExperienceQUIC(self.xpParam, self.Topo, self.TopoConfig)
|
|
||||||
elif xp ==Experience.QUICSIRI:
|
|
||||||
ExperienceQUICSiri(self.xpParam, self.Topo, self.TopoConfig)
|
|
||||||
else:
|
|
||||||
raise Exception("Unknown experience {}".format(xp))
|
|
||||||
|
|
||||||
def stopTopo(self):
|
def stopTopo(self):
|
||||||
self.Topo.stopNetwork()
|
self.Topo.stopNetwork()
|
||||||
|
Loading…
Reference in New Issue
Block a user