diff --git a/src/mpExperience.py b/src/mpExperience.py index 419a53d..2b44d2e 100644 --- a/src/mpExperience.py +++ b/src/mpExperience.py @@ -19,6 +19,7 @@ class MpExperience: MSG = "msg" SIRIHTTP = "sirihttp" SIRIMSG = "sirimsg" + QUIC = "quic" def __init__(self, xpParam, mpTopo, mpConfig): self.xpParam = xpParam diff --git a/src/mpExperienceQUIC.py b/src/mpExperienceQUIC.py new file mode 100644 index 0000000..09da2d1 --- /dev/null +++ b/src/mpExperienceQUIC.py @@ -0,0 +1,89 @@ +from mpExperience import MpExperience +from mpParamXp import MpParamXp +import os + + +class MpExperienceQUIC(MpExperience): + 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): + s = "go run " + MpExperienceQUIC.SERVER_GO_FILE + " -www . " + s += "-certpath " + MpExperienceQUIC.CERTPATH + " &>" + s += MpExperienceQUIC.SERVER_LOG + " &" + print(s) + return s + + def getQUICClientCmd(self): + s = "go run " + MpExperienceQUIC.CLIENT_GO_FILE + if int(self.multipath) > 0: + s += " -m" + s += " https://" + self.mpConfig.getServerIP() + ":6121/random &>" + MpExperienceQUIC.CLIENT_LOG + print(s) + return s + + 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) + + self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + cmd = self.getQUICClientCmd() + 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 " + MpExperienceQUIC.SERVER_GO_FILE) + self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") diff --git a/src/mpParamXp.py b/src/mpParamXp.py index 6a6538b..580a403 100644 --- a/src/mpParamXp.py +++ b/src/mpParamXp.py @@ -64,6 +64,7 @@ class MpParamXp(MpParam): MSGSERVERSLEEP = "msgServerSleep" MSGNBREQUESTS = "msgNbRequests" MSGBYTES = "msgBytes" + QUICMULTIPATH = "quicMultipath" PRIOPATH0 = "prioPath0" PRIOPATH1 = "prioPath1" BACKUPPATH0 = "backupPath0" @@ -157,6 +158,7 @@ class MpParamXp(MpParam): defaultValue[MSGSERVERSLEEP] = "5.0" defaultValue[MSGNBREQUESTS] = "5" defaultValue[MSGBYTES] = "1200" + defaultValue[QUICMULTIPATH] = "0" defaultValue[PRIOPATH0] = "0" defaultValue[PRIOPATH1] = "0" defaultValue[BACKUPPATH0] = "0" diff --git a/src/mpXpRunner.py b/src/mpXpRunner.py index 2f3aa1d..b18fe15 100644 --- a/src/mpXpRunner.py +++ b/src/mpXpRunner.py @@ -22,6 +22,7 @@ from mpExperienceDITG import MpExperienceDITG from mpExperienceMsg import MpExperienceMsg from mpExperienceSiriHTTP import MpExperienceSiriHTTP from mpExperienceSiriMsg import MpExperienceSiriMsg +from mpExperienceQUIC import MpExperienceQUIC from mpExperienceNone import MpExperienceNone from mpExperience import MpExperience from mpECMPSingleInterfaceTopo import MpECMPSingleInterfaceTopo @@ -131,6 +132,8 @@ class MpXpRunner: MpExperienceSiriHTTP(self.xpParam, self.mpTopo, self.mpTopoConfig) elif xp == MpExperience.SIRIMSG: MpExperienceSiriMsg(self.xpParam, self.mpTopo, self.mpTopoConfig) + elif xp == MpExperience.QUIC: + MpExperienceQUIC(self.xpParam, self.mpTopo, self.mpTopoConfig) else: print("Unfound xp type..." + xp)