making progress in refactoring, enabling combination of experiments

This commit is contained in:
Quentin De Coninck 2020-06-25 15:56:14 +02:00
parent 3944b0c193
commit be1d4091ea
17 changed files with 146 additions and 212 deletions

2
config/xp/sirimsg Normal file
View File

@ -0,0 +1,2 @@
xpType:sirimsg
siriRunTime:10

View File

@ -26,29 +26,8 @@ class ExperienceParameter(Parameter):
NETPERFTESTLEN = "netperfTestlen" NETPERFTESTLEN = "netperfTestlen"
NETPERFTESTNAME = "netperfTestname" NETPERFTESTNAME = "netperfTestname"
NETPERFREQRESSIZE = "netperfReqresSize" NETPERFREQRESSIZE = "netperfReqresSize"
SIRIRUNTIME = "siriRunTime"
SIRIQUERYSIZE = "siriQuerySize"
SIRIRESPONSESIZE = "siriResponseSize"
SIRIDELAYQUERYRESPONSE = "siriDelayQueryResponse"
SIRIMINPAYLOADSIZE = "siriMinPayloadSize"
SIRIMAXPAYLOADSIZE = "siriMaxPayloadSize"
SIRIINTERVALTIMEMS = "siriIntervalTimeMs"
SIRIBUFFERSIZE = "siriBufferSize"
SIRIBURSTSIZE = "siriBurstSize"
SIRIINTERVALBURSTTIMEMS = "siriIntervalBurstTimeMs"
VLCFILE = "vlcFile" VLCFILE = "vlcFile"
VLCTIME = "vlcTime" VLCTIME = "vlcTime"
DITGKBYTES = "ditgKBytes"
DITGCONSTANTPACKETSIZE = "ditgConstantPacketSize"
DITGMEANPOISSONPACKETSSEC = "ditgMeanPoissonPacketsSec"
DITGCONSTANTPACKETSSEC = "ditgConstantPacketsSec"
DITGBURSTSONPACKETSSEC = "ditgBurstsOnPacketsSec"
DITGBURSTSOFFPACKETSSEC = "ditgBurstsOffPacketsSec"
MSGCLIENTSLEEP = "msgClientSleep"
MSGSERVERSLEEP = "msgServerSleep"
MSGNBREQUESTS = "msgNbRequests"
MSGBYTES = "msgBytes"
QUICMULTIPATH = "quicMultipath" QUICMULTIPATH = "quicMultipath"
QUICSIRIRUNTIME = "quicSiriRunTime" QUICSIRIRUNTIME = "quicSiriRunTime"
PRIOPATH0 = "prioPath0" PRIOPATH0 = "prioPath0"
@ -107,27 +86,8 @@ class ExperienceParameter(Parameter):
NETPERFTESTLEN: "10", NETPERFTESTLEN: "10",
NETPERFTESTNAME: "TCP_RR", NETPERFTESTNAME: "TCP_RR",
NETPERFREQRESSIZE: "2K,256", NETPERFREQRESSIZE: "2K,256",
SIRIQUERYSIZE: "2500",
SIRIRESPONSESIZE: "750",
SIRIDELAYQUERYRESPONSE: "0",
SIRIMINPAYLOADSIZE: "85",
SIRIMAXPAYLOADSIZE: "500",
SIRIINTERVALTIMEMS: "333",
SIRIBUFFERSIZE: "9",
SIRIBURSTSIZE: "0",
SIRIINTERVALBURSTTIMEMS: "0",
VLCFILE: "bunny_ibmff_360.mpd", VLCFILE: "bunny_ibmff_360.mpd",
VLCTIME: "0", VLCTIME: "0",
DITGKBYTES: "10000",
DITGCONSTANTPACKETSIZE: "1428",
DITGMEANPOISSONPACKETSSEC: "0",
DITGCONSTANTPACKETSSEC: "0",
DITGBURSTSONPACKETSSEC: "0",
DITGBURSTSOFFPACKETSSEC: "0",
MSGCLIENTSLEEP: "5.0",
MSGSERVERSLEEP: "5.0",
MSGNBREQUESTS: "5",
MSGBYTES: "1200",
QUICMULTIPATH: "0", QUICMULTIPATH: "0",
PRIOPATH0: "0", PRIOPATH0: "0",
PRIOPATH1: "0", PRIOPATH1: "0",
@ -191,8 +151,6 @@ class Experience(object):
- A preparation phase through `prepare()` (generating experiment files,...) - A preparation phase through `prepare()` (generating experiment files,...)
- A running phase through `run()` (where the actual experience takes place) - A running phase through `run()` (where the actual experience takes place)
- A cleaning phase through `clean()` (stopping traffic, removing generated files,...) - A cleaning phase through `clean()` (stopping traffic, removing generated files,...)
Typically, this function is called in the constructor of child classes.
""" """
self.prepare() self.prepare()
self.run() self.run()
@ -486,7 +444,6 @@ class RandomFileExperience(Experience):
super(RandomFileExperience, self).__init__(experience_parameter_filename, topo, topo_config) super(RandomFileExperience, self).__init__(experience_parameter_filename, topo, topo_config)
self.load_parameters() self.load_parameters()
self.ping() self.ping()
super(RandomFileExperience, self).classic_run()
def load_parameters(self): def load_parameters(self):
super(RandomFileExperience, self).load_parameters() super(RandomFileExperience, self).load_parameters()

View File

@ -76,4 +76,3 @@ class AB(RandomFileExperience):
cmd = self.get_ab_client_cmd() cmd = self.get_ab_client_cmd()
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
self.topo.command_to(self.topo_config.client, "sleep 2") self.topo.command_to(self.topo_config.client, "sleep 2")
self.topo.get_cli()

View File

@ -1,8 +1,30 @@
from core.experience import Experience, ExperienceParameter from core.experience import Experience, ExperienceParameter
import os import os
class DITGParameter(ExperienceParameter):
KBYTES = "ditgKBytes"
CONSTANT_PACKET_SIZE = "ditgConstantPacketSize"
MEAN_POISSON_PACKETS_SEC = "ditgMeanPoissonPacketsSec"
CONSTANT_PACKETS_SEC = "ditgConstantPacketsSec"
BURSTS_ON_PACKETS_SEC = "ditgBurstsOnPacketsSec"
BURSTS_OFF_PACKETS_SEC = "ditgBurstsOffPacketsSec"
def __init__(self, experience_parameter_filename):
super(DITGParameter, self).__init__(experience_parameter_filename)
self.default_parameters.update({
DITGParameter.KBYTES: "10000",
DITGParameter.CONSTANT_PACKET_SIZE: "1428",
DITGParameter.MEAN_POISSON_PACKETS_SEC: "0",
DITGParameter.CONSTANT_PACKETS_SEC: "0",
DITGParameter.BURSTS_ON_PACKETS_SEC: "0",
DITGParameter.BURSTS_OFF_PACKETS_SEC: "0",
})
class DITG(Experience): class DITG(Experience):
NAME = "ditg" NAME = "ditg"
PARAMETER_CLASS = DITGParameter
DITG_LOG = "ditg.log" DITG_LOG = "ditg.log"
DITG_SERVER_LOG = "ditg_server.log" DITG_SERVER_LOG = "ditg_server.log"
@ -18,7 +40,6 @@ class DITG(Experience):
super(DITG, self).__init__(experience_parameter_filename, topo, topo_config) super(DITG, self).__init__(experience_parameter_filename, topo, topo_config)
self.load_parameters() self.load_parameters()
self.ping() self.ping()
super(DITG, self).classic_run()
def ping(self): def ping(self):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
@ -36,12 +57,12 @@ class DITG(Experience):
return s return s
def load_parameters(self): def load_parameters(self):
self.kbytes = self.experience_parameter.get(ExperienceParameter.DITGKBYTES) self.kbytes = self.experience_parameter.get(DITGParameter.KBYTES)
self.constant_packet_size = self.experience_parameter.get(ExperienceParameter.DITGCONSTANTPACKETSIZE) self.constant_packet_size = self.experience_parameter.get(DITGParameter.CONSTANT_PACKET_SIZE)
self.mean_poisson_packets_sec = self.experience_parameter.get(ExperienceParameter.DITGMEANPOISSONPACKETSSEC) self.mean_poisson_packets_sec = self.experience_parameter.get(DITGParameter.MEAN_POISSON_PACKETS_SEC)
self.constant_packets_sec = self.experience_parameter.get(ExperienceParameter.DITGCONSTANTPACKETSSEC) self.constant_packets_sec = self.experience_parameter.get(DITGParameter.CONSTANT_PACKETS_SEC)
self.bursts_on_packets_sec = self.experience_parameter.get(ExperienceParameter.DITGBURSTSONPACKETSSEC) self.bursts_on_packets_sec = self.experience_parameter.get(DITGParameter.BURSTS_ON_PACKETS_SEC)
self.bursts_off_packets_sec = self.experience_parameter.get(ExperienceParameter.DITGBURSTSOFFPACKETSSEC) self.bursts_off_packets_sec = self.experience_parameter.get(DITGParameter.BURSTS_OFF_PACKETS_SEC)
def prepare(self): def prepare(self):
super(DITG, self).prepare() super(DITG, self).prepare()

View File

@ -25,7 +25,6 @@ class Epload(Experience):
super(Epload, self).__init__(experience_parameter_filename, topo, topo_config) super(Epload, self).__init__(experience_parameter_filename, topo, topo_config)
self.load_parameters() self.load_parameters()
self.ping() self.ping()
super(Epload, self).classic_run()
def ping(self): def ping(self):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \

View File

@ -25,7 +25,6 @@ class IPerf(Experience):
super(IPerf, self).__init__(experience_parameter_filename, topo, topo_config) super(IPerf, self).__init__(experience_parameter_filename, topo, topo_config)
self.load_parameters() self.load_parameters()
self.ping() self.ping()
super(IPerf, self).classic_run()
def ping(self): def ping(self):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \

View File

@ -1,6 +1,22 @@
from core.experience import Experience, ExperienceParameter from core.experience import Experience, ExperienceParameter
import os import os
class MsgParameter(ExperienceParameter):
CLIENT_SLEEP = "msgClientSleep"
SERVER_SLEEP = "msgServerSleep"
NB_REQUESTS = "msgNbRequests"
BYTES = "msgBytes"
def __init__(self, experience_parameter_filename):
super(MsgParameter, self).__init__(experience_parameter_filename)
self.default_parameters.update({
MsgParameter.CLIENT_SLEEP: "5.0",
MsgParameter.SERVER_SLEEP: "5.0",
MsgParameter.NB_REQUESTS: "5",
MsgParameter.BYTES: "1200",
})
class Msg(Experience): class Msg(Experience):
NAME = "msg" NAME = "msg"
@ -13,7 +29,6 @@ class Msg(Experience):
super(Msg, self).__init__(experience_parameter_filename, topo, topo_config) super(Msg, self).__init__(experience_parameter_filename, topo, topo_config)
self.load_parameters() self.load_parameters()
self.ping() self.ping()
super(Msg, self).classic_run()
def ping(self): def ping(self):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
@ -31,10 +46,11 @@ class Msg(Experience):
return s return s
def load_parameters(self): def load_parameters(self):
self.client_sleep = self.experience_parameter.get(ExperienceParameter.MSGCLIENTSLEEP) self.client_sleep = self.experience_parameter.get(MsgParameter.CLIENT_SLEEP)
self.server_sleep = self.experience_parameter.get(ExperienceParameter.MSGSERVERSLEEP) self.server_sleep = self.experience_parameter.get(MsgParameter.SERVER_SLEEP)
self.nb_requests = self.experience_parameter.get(ExperienceParameter.MSGNBREQUESTS) self.nb_requests = self.experience_parameter.get(MsgParameter.NB_REQUESTS)
self.bytes = self.experience_parameter.get(ExperienceParameter.MSGBYTES) self.bytes = self.experience_parameter.get(MsgParameter.BYTES)
print("load parameter msg")
def prepare(self): def prepare(self):
super(Msg, self).prepare() super(Msg, self).prepare()
@ -43,16 +59,17 @@ class Msg(Experience):
self.topo.command_to(self.topo_config.server, "rm " + \ self.topo.command_to(self.topo_config.server, "rm " + \
Msg.SERVER_LOG) Msg.SERVER_LOG)
def getMsgServerCmd(self): def get_msg_server_cmd(self):
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \ s = "python {}/../utils/msg_server.py --sleep {} --bytes {} &> {}&".format(
"/utils/msg_server.py --sleep " + self.server_sleep + " --bytes " + self.bytes + " &>" + Msg.SERVER_LOG + "&" os.path.dirname(os.path.abspath(__file__)), self.server_sleep, self.bytes,
Msg.SERVER_LOG)
print(s) print(s)
return s return s
def getMsgClientCmd(self): def get_msg_client_cmd(self, daemon=False):
s = "python " + os.path.dirname(os.path.abspath(__file__)) + \ s = "python {}/../utils/msg_client.py --sleep {} --nb {} --bytes {} > {} 2> {} {}".format(
"/utils/msg_client.py --sleep " + self.client_sleep + " --nb " + self.nb_requests + \ os.path.dirname(os.path.abspath(__file__)), self.client_sleep, self.nb_requests,
" --bytes " + self.bytes + " >" + Msg.CLIENT_LOG + " 2>" + Msg.CLIENT_ERR self.bytes, Msg.CLIENT_LOG, Msg.CLIENT_ERR, "&" if daemon else "")
print(s) print(s)
return s return s
@ -60,12 +77,12 @@ class Msg(Experience):
super(Msg, self).clean() super(Msg, self).clean()
def run(self): def run(self):
cmd = self.getMsgServerCmd() cmd = self.get_msg_server_cmd()
self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before") self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before")
self.topo.command_to(self.topo_config.server, cmd) self.topo.command_to(self.topo_config.server, cmd)
self.topo.command_to(self.topo_config.client, "sleep 2") self.topo.command_to(self.topo_config.client, "sleep 2")
cmd = self.getMsgClientCmd() cmd = self.get_msg_client_cmd()
self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before") self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before")
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after") self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after")

View File

@ -34,7 +34,6 @@ class NC(Experience):
def __init__(self, experience_parameter_filename, topo, topo_config): def __init__(self, experience_parameter_filename, topo, topo_config):
super(NC, self).__init__(experience_parameter_filename, topo, topo_config) super(NC, self).__init__(experience_parameter_filename, topo, topo_config)
self.load_parameters() self.load_parameters()
super(NC, self).classic_run()
def load_parameters(self): def load_parameters(self):
self.ddibs = self.experience_parameter.get(NCParameter.DD_IBS) self.ddibs = self.experience_parameter.get(NCParameter.DD_IBS)

View File

@ -46,7 +46,6 @@ class NCPV(NC):
super(NCPV, self).__init__(experience_parameter_filename, topo, topo_config) super(NCPV, self).__init__(experience_parameter_filename, topo, topo_config)
self.load_parameters() self.load_parameters()
self.ping() self.ping()
super(NCPV, self).classic_run()
def ping(self): def ping(self):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \

View File

@ -5,7 +5,6 @@ class NoneExperience(Experience):
def __init__(self, experience_parameter_filename, topo, topo_config): def __init__(self, experience_parameter_filename, topo, topo_config):
super(NoneExperience, self).__init__(experience_parameter_filename, topo, topo_config) super(NoneExperience, self).__init__(experience_parameter_filename, topo, topo_config)
super(NoneExperience, self).classic_run()
def prepare(self): def prepare(self):
Experience.prepare(self) Experience.prepare(self)

View File

@ -7,7 +7,6 @@ class Ping(Experience):
def __init__(self, experience_parameter_filename, topo, topo_config): def __init__(self, experience_parameter_filename, topo, topo_config):
super(Ping, self).__init__(experience_parameter_filename, topo, topo_config) super(Ping, self).__init__(experience_parameter_filename, topo, topo_config)
super(Ping, self).classic_run()
def prepare(self): def prepare(self):
super(Ping, self).prepare() super(Ping, self).prepare()

View File

@ -16,7 +16,6 @@ class QUICSiri(Experience):
super(QUICSiri, self).__init__(experience_parameter_filename, topo, topo_config) super(QUICSiri, self).__init__(experience_parameter_filename, topo, topo_config)
self.load_parameters() self.load_parameters()
self.ping() self.ping()
super(QUICSiri, self).classic_run()
def ping(self): def ping(self):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \

View File

@ -1,8 +1,37 @@
from core.experience import Experience, ExperienceParameter from core.experience import Experience, ExperienceParameter
import os import os
class SiriParameter(ExperienceParameter):
RUN_TIME = "siriRunTime"
QUERY_SIZE = "siriQuerySize"
RESPONSE_SIZE = "siriResponseSize"
DELAY_QUERY_RESPONSE = "siriDelayQueryResponse"
MIN_PAYLOAD_SIZE = "siriMinPayloadSize"
MAX_PAYLOAD_SIZE = "siriMaxPayloadSize"
INTERVAL_TIME_MS = "siriIntervalTimeMs"
BUFFER_SIZE = "siriBufferSize"
BURST_SIZE = "siriBurstSize"
INTERVAL_BURST_TIME_MS = "siriIntervalBurstTimeMs"
def __init__(self, experience_parameter_filename):
super(SiriParameter, self).__init__(experience_parameter_filename)
self.default_parameters.update({
SiriParameter.QUERY_SIZE: "2500",
SiriParameter.RESPONSE_SIZE: "750",
SiriParameter.DELAY_QUERY_RESPONSE: "0",
SiriParameter.MIN_PAYLOAD_SIZE: "85",
SiriParameter.MAX_PAYLOAD_SIZE: "500",
SiriParameter.INTERVAL_TIME_MS: "333",
SiriParameter.BUFFER_SIZE: "9",
SiriParameter.BURST_SIZE: "0",
SiriParameter.INTERVAL_BURST_TIME_MS: "0",
})
class Siri(Experience): class Siri(Experience):
NAME = "siri" NAME = "siri"
PARAMETER_CLASS = SiriParameter
SERVER_LOG = "siri_server.log" SERVER_LOG = "siri_server.log"
CLIENT_LOG = "siri_client.log" CLIENT_LOG = "siri_client.log"
@ -14,7 +43,6 @@ class Siri(Experience):
super(Siri, self).__init__(experience_parameter_filename, topo, topo_config) super(Siri, self).__init__(experience_parameter_filename, topo, topo_config)
self.load_parameters() self.load_parameters()
self.ping() self.ping()
super(Siri, self).classic_run()
def ping(self): def ping(self):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
@ -32,16 +60,17 @@ class Siri(Experience):
return s return s
def load_parameters(self): def load_parameters(self):
self.run_time = self.experience_parameter.get(ExperienceParameter.SIRIRUNTIME) self.run_time = self.experience_parameter.get(SiriParameter.RUN_TIME)
self.query_size = self.experience_parameter.get(ExperienceParameter.SIRIQUERYSIZE) self.query_size = self.experience_parameter.get(SiriParameter.QUERY_SIZE)
self.response_size = self.experience_parameter.get(ExperienceParameter.SIRIRESPONSESIZE) self.response_size = self.experience_parameter.get(SiriParameter.RESPONSE_SIZE)
self.delay_query_response = self.experience_parameter.get(ExperienceParameter.SIRIDELAYQUERYRESPONSE) self.delay_query_response = self.experience_parameter.get(SiriParameter.DELAY_QUERY_RESPONSE)
self.min_payload_size = self.experience_parameter.get(ExperienceParameter.SIRIMINPAYLOADSIZE) self.min_payload_size = self.experience_parameter.get(SiriParameter.MIN_PAYLOAD_SIZE)
self.max_payload_size = self.experience_parameter.get(ExperienceParameter.SIRIMAXPAYLOADSIZE) self.max_payload_size = self.experience_parameter.get(SiriParameter.MAX_PAYLOAD_SIZE)
self.interval_time_ms = self.experience_parameter.get(ExperienceParameter.SIRIINTERVALTIMEMS) self.interval_time_ms = self.experience_parameter.get(SiriParameter.INTERVAL_TIME_MS)
self.buffer_size = self.experience_parameter.get(ExperienceParameter.SIRIBUFFERSIZE) self.buffer_size = self.experience_parameter.get(SiriParameter.BUFFER_SIZE)
self.burst_size = self.experience_parameter.get(ExperienceParameter.SIRIBURSTSIZE) self.burst_size = self.experience_parameter.get(SiriParameter.BURST_SIZE)
self.interval_burst_time_ms = self.experience_parameter.get(ExperienceParameter.SIRIINTERVALBURSTTIMEMS) self.interval_burst_time_ms = self.experience_parameter.get(SiriParameter.INTERVAL_BURST_TIME_MS)
print("load parameter siri")
def prepare(self): def prepare(self):
super(Siri, self).prepare() super(Siri, self).prepare()
@ -50,18 +79,18 @@ class Siri(Experience):
self.topo.command_to(self.topo_config.server, "rm " + \ self.topo.command_to(self.topo_config.server, "rm " + \
Siri.SERVER_LOG) Siri.SERVER_LOG)
def getSiriServerCmd(self): def get_siri_server_cmd(self):
s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \ s = "python3 {}/../utils/siri_server.py &> {}&".format(
"/utils/siri_server.py &>" + Siri.SERVER_LOG + "&" os.path.dirname(os.path.abspath(__file__)), Siri.SERVER_LOG)
print(s) print(s)
return s return s
def getSiriClientCmd(self): def get_siri_client_cmd(self):
s = Siri.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/utils/siriClient.jar " + \ s = "{} -jar {}/../utils/siriClient.jar {} 8080 {} {} {} {} {} {} {} {} {} {} > {} 2> {}".format(
self.topo_config.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \ Siri.JAVA_BIN, os.path.dirname(os.path.abspath(__file__)), self.topo_config.getServerIP(),
" " + self.delay_query_response + " " + self.min_payload_size + " " + \ self.run_time, self.query_size, self.response_size, self.delay_query_response,
self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + " " + self.burst_size + " " + self.interval_burst_time_ms + \ self.min_payload_size, self.max_payload_size, self.interval_time_ms, self.buffer_size,
" >" + Siri.CLIENT_LOG + " 2>" + Siri.CLIENT_ERR self.burst_size, self.interval_burst_time_ms, Siri.CLIENT_LOG, Siri.CLIENT_ERR)
print(s) print(s)
return s return s
@ -69,12 +98,12 @@ class Siri(Experience):
super(Siri, self).clean() super(Siri, self).clean()
def run(self): def run(self):
cmd = self.getSiriServerCmd() cmd = self.get_siri_server_cmd()
self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before") self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before")
self.topo.command_to(self.topo_config.server, cmd) self.topo.command_to(self.topo_config.server, cmd)
self.topo.command_to(self.topo_config.client, "sleep 2") self.topo.command_to(self.topo_config.client, "sleep 2")
cmd = self.getSiriClientCmd() cmd = self.get_siri_client_cmd()
self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before") self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before")
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after") self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after")

View File

@ -1,7 +1,8 @@
from core.experience import ExperienceParameter, RandomFileExperience, RandomFileParameter from core.experience import ExperienceParameter, RandomFileExperience, RandomFileParameter
from .siri import Siri
import os import os
class SiriHTTP(RandomFileExperience): class SiriHTTP(Siri, RandomFileExperience):
NAME = "sirihttp" NAME = "sirihttp"
HTTP_SERVER_LOG = "http_server.log" HTTP_SERVER_LOG = "http_server.log"
@ -33,18 +34,8 @@ class SiriHTTP(RandomFileExperience):
return s return s
def load_parameters(self): def load_parameters(self):
# Start collecting parameters of RandomFileExperiment # Start collecting parameters of RandomFileExperiment and Siri
super(SiriHTTP, self).load_parameters() super(SiriHTTP, self).load_parameters()
self.run_time = self.experience_parameter.get(ExperienceParameter.SIRIRUNTIME)
self.query_size = self.experience_parameter.get(ExperienceParameter.SIRIQUERYSIZE)
self.response_size = self.experience_parameter.get(ExperienceParameter.SIRIRESPONSESIZE)
self.delay_query_response = self.experience_parameter.get(ExperienceParameter.SIRIDELAYQUERYRESPONSE)
self.min_payload_size = self.experience_parameter.get(ExperienceParameter.SIRIMINPAYLOADSIZE)
self.max_payload_size = self.experience_parameter.get(ExperienceParameter.SIRIMAXPAYLOADSIZE)
self.interval_time_ms = self.experience_parameter.get(ExperienceParameter.SIRIINTERVALTIMEMS)
self.buffer_size = self.experience_parameter.get(ExperienceParameter.SIRIBUFFERSIZE)
self.burst_size = self.experience_parameter.get(ExperienceParameter.SIRIBURSTSIZE)
self.interval_burst_time_ms = self.experience_parameter.get(ExperienceParameter.SIRIINTERVALBURSTTIMEMS)
def prepare(self): def prepare(self):
super(SiriHTTP, self).prepare() super(SiriHTTP, self).prepare()
@ -56,26 +47,6 @@ class SiriHTTP(RandomFileExperience):
SiriHTTP.HTTP_CLIENT_LOG) SiriHTTP.HTTP_CLIENT_LOG)
self.topo.command_to(self.topo_config.server, "rm " + \ self.topo.command_to(self.topo_config.server, "rm " + \
SiriHTTP.HTTP_SERVER_LOG) SiriHTTP.HTTP_SERVER_LOG)
if self.file == "random":
self.topo.command_to(self.topo_config.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.topo_config.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): def getHTTPServerCmd(self):
s = "/etc/init.d/apache2 restart &>" + SiriHTTP.SERVER_LOG + "&" s = "/etc/init.d/apache2 restart &>" + SiriHTTP.SERVER_LOG + "&"
@ -90,11 +61,9 @@ class SiriHTTP(RandomFileExperience):
def clean(self): def clean(self):
super(SiriHTTP, self).clean() super(SiriHTTP, self).clean()
if self.file == "random":
self.topo.command_to(self.topo_config.client, "rm random*")
def run(self): def run(self):
cmd = self.getSiriServerCmd() cmd = self.get_siri_server_cmd()
self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before") self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before")
self.topo.command_to(self.topo_config.server, cmd) self.topo.command_to(self.topo_config.server, cmd)
cmd = self.getHTTPServerCmd() cmd = self.getHTTPServerCmd()
@ -104,7 +73,7 @@ class SiriHTTP(RandomFileExperience):
self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before") self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before")
cmd = self.getHTTPClientCmd() cmd = self.getHTTPClientCmd()
self.topo.command_to(self.topo_config.client, "for i in {1..200}; do " + cmd + "; done &") self.topo.command_to(self.topo_config.client, "for i in {1..200}; do " + cmd + "; done &")
cmd = self.getSiriClientCmd() cmd = self.get_siri_client_cmd()
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after") self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after")
self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_after") self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_after")

View File

@ -1,8 +1,20 @@
from core.experience import Experience, ExperienceParameter from core.experience import ExperienceParameter
from .siri import Siri, SiriParameter
from .msg import Msg, MsgParameter
import os import os
class SiriMsg(Experience):
class SiriMsgParameter(SiriParameter, MsgParameter):
"""
This class is needed because Python has no way to know what we prefer over Siri or
Msg parameters. So explicitly state that we want both.
"""
pass
class SiriMsg(Siri, Msg):
NAME = "sirimsg" NAME = "sirimsg"
PARAMETER_CLASS = SiriMsgParameter
MSG_SERVER_LOG = "msg_server.log" MSG_SERVER_LOG = "msg_server.log"
MSG_CLIENT_LOG = "msg_client.log" MSG_CLIENT_LOG = "msg_client.log"
@ -15,98 +27,34 @@ class SiriMsg(Experience):
def __init__(self, experience_parameter_filename, topo, topo_config): def __init__(self, experience_parameter_filename, topo, topo_config):
super(SiriMsg, self).__init__(experience_parameter_filename, topo, topo_config) super(SiriMsg, self).__init__(experience_parameter_filename, topo, topo_config)
self.load_parameters()
self.ping()
super(SiriMsg, self).classic_run()
def ping(self):
self.topo.command_to(self.topo_config.client, "rm " + \
SiriMsg.PING_OUTPUT )
count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.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 load_parameters(self): def load_parameters(self):
self.run_time = self.experience_parameter.get(ExperienceParameter.SIRIRUNTIME) # Fetch both Msg and Siri parameters
self.query_size = self.experience_parameter.get(ExperienceParameter.SIRIQUERYSIZE) Siri.load_parameters(self)
self.response_size = self.experience_parameter.get(ExperienceParameter.SIRIRESPONSESIZE) Msg.load_parameters(self)
self.delay_query_response = self.experience_parameter.get(ExperienceParameter.SIRIDELAYQUERYRESPONSE)
self.min_payload_size = self.experience_parameter.get(ExperienceParameter.SIRIMINPAYLOADSIZE)
self.max_payload_size = self.experience_parameter.get(ExperienceParameter.SIRIMAXPAYLOADSIZE)
self.interval_time_ms = self.experience_parameter.get(ExperienceParameter.SIRIINTERVALTIMEMS)
self.buffer_size = self.experience_parameter.get(ExperienceParameter.SIRIBUFFERSIZE)
self.burst_size = self.experience_parameter.get(ExperienceParameter.SIRIBURSTSIZE)
self.interval_burst_time_ms = self.experience_parameter.get(ExperienceParameter.SIRIINTERVALBURSTTIMEMS)
self.client_sleep = self.experience_parameter.get(ExperienceParameter.MSGCLIENTSLEEP)
self.server_sleep = self.experience_parameter.get(ExperienceParameter.MSGSERVERSLEEP)
self.nb_requests = self.experience_parameter.get(ExperienceParameter.MSGNBREQUESTS)
def prepare(self): def prepare(self):
super(SiriMsg, self).prepare() # Should be the combination of Siri and Msg
self.topo.command_to(self.topo_config.client, "rm " + \ Siri.prepare(self)
SiriMsg.CLIENT_LOG) Msg.prepare(self)
self.topo.command_to(self.topo_config.client, "rm " + \
SiriMsg.CLIENT_ERR)
self.topo.command_to(self.topo_config.server, "rm " + \
SiriMsg.SERVER_LOG)
self.topo.command_to(self.topo_config.client, "rm " + \
SiriMsg.MSG_CLIENT_LOG)
self.topo.command_to(self.topo_config.client, "rm " + \
SiriMsg.MSG_CLIENT_ERR)
self.topo.command_to(self.topo_config.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.topo_config.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): def clean(self):
super(SiriMsg, self).clean() # Should be the combination of Siri and Msg
Siri.clean(self)
Msg.clean(self)
def run(self): def run(self):
cmd = self.getSiriServerCmd() cmd = self.get_siri_server_cmd()
self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before") self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before")
self.topo.command_to(self.topo_config.server, cmd) self.topo.command_to(self.topo_config.server, cmd)
cmd = self.getMsgServerCmd() cmd = self.get_msg_server_cmd()
self.topo.command_to(self.topo_config.server, cmd) self.topo.command_to(self.topo_config.server, cmd)
self.topo.command_to(self.topo_config.client, "sleep 2") self.topo.command_to(self.topo_config.client, "sleep 2")
self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before") self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before")
cmd = self.getMsgClientCmd() cmd = self.get_msg_client_cmd(daemon=True)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
cmd = self.getSiriClientCmd() cmd = self.get_siri_client_cmd()
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after") self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after")
self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_after") self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_after")

View File

@ -13,7 +13,6 @@ class VLC(Experience):
super(VLC, self).__init__(experience_parameter_filename, topo, topo_config) super(VLC, self).__init__(experience_parameter_filename, topo, topo_config)
self.load_parameters() self.load_parameters()
self.ping() self.ping()
super(VLC, self).classic_run()
def ping(self): def ping(self):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \

View File

@ -74,9 +74,9 @@ class Runner(object):
""" """
# Well, we need to load twice the experience parameters, is it really annoying? # Well, we need to load twice the experience parameters, is it really annoying?
xp = ExperienceParameter(experience_parameter_file).get(ExperienceParameter.XPTYPE) xp = ExperienceParameter(experience_parameter_file).get(ExperienceParameter.XPTYPE)
print(EXPERIENCES)
if xp in EXPERIENCES: if xp in EXPERIENCES:
EXPERIENCES[xp](experience_parameter_file, self.topo, self.topo_config) exp = EXPERIENCES[xp](experience_parameter_file, self.topo, self.topo_config)
exp.classic_run()
else: else:
raise Exception("Unknown experience {}".format(xp)) raise Exception("Unknown experience {}".format(xp))