diff --git a/.gitignore b/.gitignore index f2a1ab4..0c5140a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,4 @@ *.pcap *.xpl *.patch -__pycache__ +__pycache__ \ No newline at end of file diff --git a/config/simple/topo b/config/topo/topo_1 similarity index 100% rename from config/simple/topo rename to config/topo/topo_1 diff --git a/config/https/topo b/config/topo/topo_2 similarity index 100% rename from config/https/topo rename to config/topo/topo_2 diff --git a/config/https/xp b/config/xp/https similarity index 100% rename from config/https/xp rename to config/xp/https diff --git a/config/xp/iperf b/config/xp/iperf new file mode 100644 index 0000000..291e197 --- /dev/null +++ b/config/xp/iperf @@ -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 + diff --git a/config/simple/xp b/config/xp/none similarity index 100% rename from config/simple/xp rename to config/xp/none diff --git a/config/xp/ping b/config/xp/ping new file mode 100644 index 0000000..79a7eb9 --- /dev/null +++ b/config/xp/ping @@ -0,0 +1,3 @@ +xpType:ping +pingCount:16 +rmem:87380 87380 87380 diff --git a/core/experience.py b/core/experience.py index 83125c8..3af754f 100644 --- a/core/experience.py +++ b/core/experience.py @@ -9,24 +9,6 @@ class Experience(object): `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): self.xpParam = xpParam self.mpTopo = mpTopo diff --git a/core/parameter.py b/core/parameter.py index 58d4654..2b583a1 100644 --- a/core/parameter.py +++ b/core/parameter.py @@ -1,45 +1,45 @@ class Parameter(object): - def __init__(self, paramFile): - self.paramDic = {} - print("Create the param Object") - if paramFile is None: - print("default param...") - else: - self.loadParamFile(paramFile) + def __init__(self, paramFile): + self.paramDic = {} + print("Create the param Object") + if paramFile is None: + print("default param...") + else: + self.loadParamFile(paramFile) - def loadParamFile(self, paramFile): - f = open(paramFile) - i = 0 - for l in f: - i = i + 1 - if l.startswith("#"): - continue + def loadParamFile(self, paramFile): + f = open(paramFile) + i = 0 + for l in f: + i = i + 1 + if l.startswith("#"): + continue - tab = l.split(":") - if len(tab) == 2: - k = tab[0] - val = tab[1].rstrip() - if k in self.paramDic: - if not isinstance(self.paramDic[k], list): - self.paramDic[k] = [self.paramDic[k]] - self.paramDic[k].append(val) - else: - self.paramDic[k] = val - else: - print("Ignored Line " + str(i)) - print(l), - print("In file " + paramFile) - f.close() + tab = l.split(":") + if len(tab) == 2: + k = tab[0] + val = tab[1].rstrip() + if k in self.paramDic: + if not isinstance(self.paramDic[k], list): + self.paramDic[k] = [self.paramDic[k]] + self.paramDic[k].append(val) + else: + self.paramDic[k] = val + else: + print("Ignored Line " + str(i)) + print(l), + print("In file " + paramFile) + f.close() - def getParam(self, key): - if key in self.paramDic: - return self.paramDic[key] - return None + def getParam(self, key): + if key in self.paramDic: + return self.paramDic[key] + return None - def __str__(self): - s = self.paramDic.__str__() - return s + def __str__(self): + s = self.paramDic.__str__() + return s class ExperienceParameter(Parameter): diff --git a/experiences/epload.py b/experiences/epload.py new file mode 100644 index 0000000..c1ea6ac --- /dev/null +++ b/experiences/epload.py @@ -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) diff --git a/experiences/iperf.py b/experiences/iperf.py new file mode 100644 index 0000000..1b37d97 --- /dev/null +++ b/experiences/iperf.py @@ -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") diff --git a/experiences/msg.py b/experiences/msg.py new file mode 100644 index 0000000..828a7e0 --- /dev/null +++ b/experiences/msg.py @@ -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") diff --git a/experiences/nc.py b/experiences/nc.py new file mode 100644 index 0000000..50e2ade --- /dev/null +++ b/experiences/nc.py @@ -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") + diff --git a/experiences/ncpv.py b/experiences/ncpv.py new file mode 100644 index 0000000..3f5b3d7 --- /dev/null +++ b/experiences/ncpv.py @@ -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") + diff --git a/experiences/netperf.py b/experiences/netperf.py new file mode 100644 index 0000000..97a2802 --- /dev/null +++ b/experiences/netperf.py @@ -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") diff --git a/experiences/ping.py b/experiences/ping.py index e0bb407..0e2af0a 100644 --- a/experiences/ping.py +++ b/experiences/ping.py @@ -1,31 +1,31 @@ from core.experience import Experience, ExperienceParameter class Ping(Experience): - NAME = "ping" + NAME = "ping" - PING_OUTPUT = "ping.log" + PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(Ping, self).__init__(xpParamFile, mpTopo, mpConfig) - super(Ping, self).classicRun() + def __init__(self, xpParamFile, mpTopo, mpConfig): + super(Ping, self).__init__(xpParamFile, mpTopo, mpConfig) + super(Ping, self).classicRun() - def prepare(self): - super(Ping, self).prepare() + def prepare(self): + super(Ping, self).prepare() - def clean(self): - super(Ping, self).clean() + def clean(self): + super(Ping, self).clean() - def run(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ - Ping.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 run(self): + self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + Ping.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 + \ - " >> " + Ping.PING_OUTPUT - print(s) - return s + def pingCommand(self, fromIP, toIP, n=5): + s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ + " >> " + Ping.PING_OUTPUT + print(s) + return s diff --git a/experiences/quic.py b/experiences/quic.py new file mode 100644 index 0000000..fe7a266 --- /dev/null +++ b/experiences/quic.py @@ -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_*") diff --git a/experiences/quic_siri.py b/experiences/quic_siri.py new file mode 100644 index 0000000..ab68887 --- /dev/null +++ b/experiences/quic_siri.py @@ -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*") diff --git a/experiences/send_file.py b/experiences/send_file.py new file mode 100644 index 0000000..ddf3879 --- /dev/null +++ b/experiences/send_file.py @@ -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") diff --git a/experiences/siri.py b/experiences/siri.py new file mode 100644 index 0000000..2a18d09 --- /dev/null +++ b/experiences/siri.py @@ -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") diff --git a/experiences/siri_http.py b/experiences/siri_http.py new file mode 100644 index 0000000..da9ac61 --- /dev/null +++ b/experiences/siri_http.py @@ -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") diff --git a/experiences/siri_msg.py b/experiences/siri_msg.py new file mode 100644 index 0000000..125ef0e --- /dev/null +++ b/experiences/siri_msg.py @@ -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") diff --git a/experiences/vlc.py b/experiences/vlc.py new file mode 100644 index 0000000..9760cfa --- /dev/null +++ b/experiences/vlc.py @@ -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") diff --git a/mpExperienceEpload.py b/mpExperienceEpload.py deleted file mode 100644 index 213f915..0000000 --- a/mpExperienceEpload.py +++ /dev/null @@ -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) diff --git a/mpExperienceIperf.py b/mpExperienceIperf.py deleted file mode 100644 index 1a357a8..0000000 --- a/mpExperienceIperf.py +++ /dev/null @@ -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") diff --git a/mpExperienceMsg.py b/mpExperienceMsg.py deleted file mode 100644 index 7965bdc..0000000 --- a/mpExperienceMsg.py +++ /dev/null @@ -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") diff --git a/mpExperienceNC.py b/mpExperienceNC.py deleted file mode 100644 index aa70510..0000000 --- a/mpExperienceNC.py +++ /dev/null @@ -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") - diff --git a/mpExperienceNCPV.py b/mpExperienceNCPV.py deleted file mode 100644 index 5347f86..0000000 --- a/mpExperienceNCPV.py +++ /dev/null @@ -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") - diff --git a/mpExperienceNetperf.py b/mpExperienceNetperf.py deleted file mode 100644 index 8a49b69..0000000 --- a/mpExperienceNetperf.py +++ /dev/null @@ -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") diff --git a/mpExperienceQUIC.py b/mpExperienceQUIC.py deleted file mode 100644 index 6206bc9..0000000 --- a/mpExperienceQUIC.py +++ /dev/null @@ -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_*") diff --git a/mpExperienceQUICSiri.py b/mpExperienceQUICSiri.py deleted file mode 100644 index 4726ace..0000000 --- a/mpExperienceQUICSiri.py +++ /dev/null @@ -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*") diff --git a/mpExperienceSendFile.py b/mpExperienceSendFile.py deleted file mode 100644 index 8c8091e..0000000 --- a/mpExperienceSendFile.py +++ /dev/null @@ -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") diff --git a/mpExperienceSiri.py b/mpExperienceSiri.py deleted file mode 100644 index a523551..0000000 --- a/mpExperienceSiri.py +++ /dev/null @@ -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") diff --git a/mpExperienceSiriHTTP.py b/mpExperienceSiriHTTP.py deleted file mode 100644 index 17b8e27..0000000 --- a/mpExperienceSiriHTTP.py +++ /dev/null @@ -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") diff --git a/mpExperienceSiriMsg.py b/mpExperienceSiriMsg.py deleted file mode 100644 index ebf0494..0000000 --- a/mpExperienceSiriMsg.py +++ /dev/null @@ -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") diff --git a/mpExperienceVLC.py b/mpExperienceVLC.py deleted file mode 100644 index acad9e4..0000000 --- a/mpExperienceVLC.py +++ /dev/null @@ -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") diff --git a/mpXpRunner.py b/mpXpRunner.py index 05ed847..09879fd 100644 --- a/mpXpRunner.py +++ b/mpXpRunner.py @@ -3,103 +3,55 @@ from core.topo import Topo, TopoParameter from mininet_builder import MininetBuilder -from topos import TOPO_CONFIGS, TOPOS from experiences import EXPERIENCES - -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 +from topos import TOPO_CONFIGS, TOPOS class MpXpRunner: - def __init__(self, builderType, topoParamFile, xpParamFile): - self.defParamXp(xpParamFile) - self.topoParam = TopoParameter(topoParamFile) - self.defBuilder(builderType) - self.defTopo() - self.defConfig() - self.startTopo() - self.runXp() - self.stopTopo() + def __init__(self, builderType, topoParamFile, xpParamFile): + self.defParamXp(xpParamFile) + self.topoParam = TopoParameter(topoParamFile) + self.defBuilder(builderType) + self.defTopo() + self.defConfig() + self.startTopo() + self.runXp() + self.stopTopo() - def defParamXp(self, xpParamFile): - self.xpParam = ExperienceParameter(xpParamFile) + def defParamXp(self, xpParamFile): + self.xpParam = ExperienceParameter(xpParamFile) - def defBuilder(self, builderType): - if builderType == Topo.mininetBuilder: - self.topoBuilder = MininetBuilder() - else: - raise Exception("I can not find the builder " + - builderType) - def defTopo(self): - t = self.topoParam.getParam(Topo.topoAttr) - if t in TOPOS: - self.Topo = TOPOS[t](self.topoBuilder, self.topoParam) - else: - raise Exception("Unknown topo: {}".format(t)) - print(self.Topo) + def defBuilder(self, builderType): + if builderType == Topo.mininetBuilder: + self.topoBuilder = MininetBuilder() + else: + raise Exception("I can not find the builder " + + builderType) + def defTopo(self): + t = self.topoParam.getParam(Topo.topoAttr) + if t in TOPOS: + self.Topo = TOPOS[t](self.topoBuilder, self.topoParam) + else: + raise Exception("Unknown topo: {}".format(t)) + print(self.Topo) - def defConfig(self): - t = self.topoParam.getParam(Topo.topoAttr) - if t in TOPO_CONFIGS: - self.TopoConfig = TOPO_CONFIGS[t](self.Topo, self.topoParam) - else: - raise Exception("Unknown topo config: {}".format(t)) + def defConfig(self): + t = self.topoParam.getParam(Topo.topoAttr) + if t in TOPO_CONFIGS: + self.TopoConfig = TOPO_CONFIGS[t](self.Topo, self.topoParam) + else: + raise Exception("Unknown topo config: {}".format(t)) - def startTopo(self): - self.Topo.startNetwork() - self.TopoConfig.configureNetwork() + def startTopo(self): + self.Topo.startNetwork() + self.TopoConfig.configureNetwork() - def runXp(self): - xp = self.xpParam.getParam(ExperienceParameter.XPTYPE) - if xp in EXPERIENCES: - EXPERIENCES[xp](self.xpParam, self.Topo, self.TopoConfig) - elif xp ==Experience.NCPV: - ExperienceNCPV(self.xpParam, self.Topo, - self.TopoConfig) - elif xp ==Experience.NC: - ExperienceNC(self.xpParam, self.Topo, - self.TopoConfig) - elif xp ==Experience.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 runXp(self): + xp = self.xpParam.getParam(ExperienceParameter.XPTYPE) + if xp in EXPERIENCES: + EXPERIENCES[xp](self.xpParam, self.Topo, self.TopoConfig) + else: + raise Exception("Unknown experience {}".format(xp)) - def stopTopo(self): - self.Topo.stopNetwork() + def stopTopo(self): + self.Topo.stopNetwork()