2017-05-05 11:19:03 +00:00
|
|
|
from mpExperience import MpExperience
|
2017-06-12 08:45:40 +00:00
|
|
|
from mpMultiInterfaceCongConfig import MpMultiInterfaceCongConfig
|
2017-05-05 11:19:03 +00:00
|
|
|
from mpParamXp import MpParamXp
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
class MpExperienceQUIC(MpExperience):
|
2017-05-05 12:14:44 +00:00
|
|
|
GO_BIN = "/usr/local/go/bin/go"
|
2017-06-12 08:45:40 +00:00
|
|
|
WGET = "~/git/wget/src/wget"
|
2017-05-05 11:19:03 +00:00
|
|
|
SERVER_LOG = "quic_server.log"
|
|
|
|
CLIENT_LOG = "quic_client.log"
|
|
|
|
CLIENT_GO_FILE = "~/go/src/github.com/lucas-clemente/quic-go/example/client_benchmarker/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):
|
|
|
|
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
|
|
|
self.loadParam()
|
|
|
|
self.ping()
|
|
|
|
MpExperience.classicRun(self)
|
|
|
|
|
|
|
|
def ping(self):
|
|
|
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
|
|
MpExperienceQUIC.PING_OUTPUT )
|
|
|
|
count = self.xpParam.getParam(MpParamXp.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 + \
|
|
|
|
" >> " + MpExperienceQUIC.PING_OUTPUT
|
|
|
|
print(s)
|
|
|
|
return s
|
|
|
|
|
|
|
|
def loadParam(self):
|
|
|
|
"""
|
|
|
|
todo : param LD_PRELOAD ??
|
|
|
|
"""
|
|
|
|
self.file = self.xpParam.getParam(MpParamXp.HTTPSFILE)
|
|
|
|
self.random_size = self.xpParam.getParam(MpParamXp.HTTPSRANDOMSIZE)
|
|
|
|
self.multipath = self.xpParam.getParam(MpParamXp.QUICMULTIPATH)
|
|
|
|
|
|
|
|
def prepare(self):
|
|
|
|
MpExperience.prepare(self)
|
|
|
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
|
|
|
MpExperienceQUIC.CLIENT_LOG )
|
|
|
|
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
|
|
|
MpExperienceQUIC.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):
|
2017-05-05 12:10:33 +00:00
|
|
|
s = MpExperienceQUIC.GO_BIN + " run " + MpExperienceQUIC.SERVER_GO_FILE
|
|
|
|
s += " -www . -certpath " + MpExperienceQUIC.CERTPATH + " &>"
|
2017-05-05 11:19:03 +00:00
|
|
|
s += MpExperienceQUIC.SERVER_LOG + " &"
|
|
|
|
print(s)
|
|
|
|
return s
|
|
|
|
|
|
|
|
def getQUICClientCmd(self):
|
2017-05-05 12:10:33 +00:00
|
|
|
s = MpExperienceQUIC.GO_BIN + " run " + MpExperienceQUIC.CLIENT_GO_FILE
|
2017-05-05 11:19:03 +00:00
|
|
|
if int(self.multipath) > 0:
|
|
|
|
s += " -m"
|
|
|
|
s += " https://" + self.mpConfig.getServerIP() + ":6121/random &>" + MpExperienceQUIC.CLIENT_LOG
|
|
|
|
print(s)
|
|
|
|
return s
|
|
|
|
|
2017-06-12 08:45:40 +00:00
|
|
|
def getCongServerCmd(self, congID):
|
|
|
|
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \
|
|
|
|
"/https.py &> https_server" + str(congID) + ".log &"
|
|
|
|
print(s)
|
|
|
|
return s
|
|
|
|
|
|
|
|
def getCongClientCmd(self, congID):
|
|
|
|
s = "(time " + MpExperienceQUIC.WGET + " https://" + self.mpConfig.getServerCongIP(congID) +\
|
|
|
|
"/" + self.file + " --no-check-certificate --disable-mptcp) &> https_client" + str(congID) + ".log &"
|
|
|
|
print(s)
|
|
|
|
return s
|
|
|
|
|
2017-05-05 11:19:03 +00:00
|
|
|
def clean(self):
|
|
|
|
MpExperience.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)
|
|
|
|
|
2017-06-12 08:45:40 +00:00
|
|
|
if isinstance(self.mpConfig, MpMultiInterfaceCongConfig):
|
|
|
|
i = 0
|
|
|
|
for cs in self.mpConfig.cong_servers:
|
|
|
|
cmd = self.getCongServerCmd(i)
|
|
|
|
self.mpTopo.commandTo(cs, cmd)
|
|
|
|
i = i + 1
|
|
|
|
|
2017-05-05 11:19:03 +00:00
|
|
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
2017-06-12 08:45:40 +00:00
|
|
|
|
2017-05-05 11:19:03 +00:00
|
|
|
self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before")
|
2017-06-12 08:45:40 +00:00
|
|
|
# First run congestion clients, then the main one
|
|
|
|
if isinstance(self.mpConfig, MpMultiInterfaceCongConfig):
|
|
|
|
i = 0
|
|
|
|
for cc in self.mpConfig.cong_clients:
|
|
|
|
cmd = self.getCongClientCmd(i)
|
|
|
|
self.mpTopo.commandTo(cc, cmd)
|
|
|
|
i = i + 1
|
|
|
|
|
|
|
|
cmd = self.getQUICClientCmd()
|
2017-05-05 11:19:03 +00:00
|
|
|
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")
|
2017-06-12 08:45:40 +00:00
|
|
|
# Wait for congestion traffic to end
|
|
|
|
if isinstance(self.mpConfig, MpMultiInterfaceCongConfig):
|
|
|
|
for cc in self.mpConfig.cong_clients:
|
|
|
|
self.mpTopo.commandTo(cc, "while pkill -f wget -0; do sleep 0.5; done")
|
|
|
|
|
2017-05-05 11:19:03 +00:00
|
|
|
self.mpTopo.commandTo(self.mpConfig.server, "pkill -f " + MpExperienceQUIC.SERVER_GO_FILE)
|
2017-06-12 08:45:40 +00:00
|
|
|
if isinstance(self.mpConfig, MpMultiInterfaceCongConfig):
|
|
|
|
for cs in self.mpConfig.cong_servers:
|
|
|
|
self.mpTopo.commandTo(cs, "pkill -f https.py")
|
|
|
|
|
2017-05-05 11:19:03 +00:00
|
|
|
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
2017-05-11 13:00:31 +00:00
|
|
|
# Need to delete the go-build directory in tmp; could lead to no more space left error
|
2017-05-11 13:12:47 +00:00
|
|
|
self.mpTopo.commandTo(self.mpConfig.client, "rm -r /tmp/go-build*")
|