From 36fed8cc71681eff9a1a80518af927afa3d96948 Mon Sep 17 00:00:00 2001 From: Quentin De Coninck Date: Fri, 26 Jun 2020 08:52:56 +0200 Subject: [PATCH] rename experience -> experiment --- core/{experience.py => experiment.py} | 124 +++++++++++----------- experiences/none.py | 16 --- {experiences => experiments}/__init__.py | 8 +- {experiences => experiments}/ab.py | 18 ++-- {experiences => experiments}/ditg.py | 30 +++--- {experiences => experiments}/epload.py | 18 ++-- {experiences => experiments}/http.py | 10 +- {experiences => experiments}/https.py | 10 +- {experiences => experiments}/iperf.py | 20 ++-- {experiences => experiments}/msg.py | 24 ++--- {experiences => experiments}/nc.py | 32 +++--- {experiences => experiments}/ncpv.py | 22 ++-- {experiences => experiments}/netperf.py | 22 ++-- experiments/none.py | 16 +++ {experiences => experiments}/ping.py | 10 +- {experiences => experiments}/quic.py | 20 ++-- {experiences => experiments}/quic_siri.py | 20 ++-- {experiences => experiments}/send_file.py | 12 +-- {experiences => experiments}/siri.py | 36 +++---- {experiences => experiments}/siri_http.py | 10 +- {experiences => experiments}/siri_msg.py | 6 +- {experiences => experiments}/vlc.py | 20 ++-- runner.py | 28 ++--- 23 files changed, 266 insertions(+), 266 deletions(-) rename core/{experience.py => experiment.py} (79%) delete mode 100644 experiences/none.py rename {experiences => experiments}/__init__.py (75%) rename {experiences => experiments}/ab.py (80%) rename {experiences => experiments}/ditg.py (81%) rename {experiences => experiments}/epload.py (85%) rename {experiences => experiments}/http.py (88%) rename {experiences => experiments}/https.py (89%) rename {experiences => experiments}/iperf.py (78%) rename {experiences => experiments}/msg.py (81%) rename {experiences => experiments}/nc.py (72%) rename {experiences => experiments}/ncpv.py (87%) rename {experiences => experiments}/netperf.py (79%) create mode 100644 experiments/none.py rename {experiences => experiments}/ping.py (74%) rename {experiences => experiments}/quic.py (89%) rename {experiences => experiments}/quic_siri.py (84%) rename {experiences => experiments}/send_file.py (83%) rename {experiences => experiments}/siri.py (78%) rename {experiences => experiments}/siri_http.py (90%) rename {experiences => experiments}/siri_msg.py (92%) rename {experiences => experiments}/vlc.py (82%) diff --git a/core/experience.py b/core/experiment.py similarity index 79% rename from core/experience.py rename to core/experiment.py index 4eac806..6fa6ac8 100644 --- a/core/experience.py +++ b/core/experiment.py @@ -1,9 +1,9 @@ from .parameter import Parameter from topos.multi_interface import MultiInterfaceTopo -class ExperienceParameter(Parameter): +class ExperimentParameter(Parameter): """ - Handler for experience parameters stored in configuration files + Handler for experiment parameters stored in configuration files """ RMEM = "rmem" WMEM = "wmem" @@ -53,7 +53,7 @@ class ExperienceParameter(Parameter): KERNELPMS: "net.mptcp.mptcp_path_manager", } - # Default values for unspecified experience parameters + # Default values for unspecified experiment parameters DEFAULT_PARAMETERS = { RMEM: "10240 87380 16777216", WMEM: "4096 16384 4194304", @@ -83,11 +83,11 @@ class ExperienceParameter(Parameter): } def __init__(self, parameter_filename): - super(ExperienceParameter, self).__init__(parameter_filename) - self.default_parameters = ExperienceParameter.DEFAULT_PARAMETERS + super(ExperimentParameter, self).__init__(parameter_filename) + self.default_parameters = ExperimentParameter.DEFAULT_PARAMETERS def get(self, key): - val = super(ExperienceParameter, self).get(key) + val = super(ExperimentParameter, self).get(key) if val is None: if key in self.default_parameters: return self.default_parameters[key] @@ -97,37 +97,37 @@ class ExperienceParameter(Parameter): return val -class Experience(object): +class Experiment(object): """ - Base class to instantiate an experience to perform. + Base class to instantiate an experiment to perform. This class is not instantiable as it. You must define a child class with the `NAME` attribute. - By default, an Experience relies on an instance of ExperienceParameter to - collect the parameters from the experience configuration file. However, an - experience may introduce specific parameters in the configuration file. In + By default, an Experiment relies on an instance of ExperimentParameter to + collect the parameters from the experiment configuration file. However, an + experiment may introduce specific parameters in the configuration file. In such case, the inherinting class must override the `PARAMETER_CLASS` class - variable to point to another class inheriting from ExperienceParameter. + variable to point to another class inheriting from ExperimentParameter. Attributes: - experience_parameter Instance of ExperienceParameter + experiment_parameter Instance of ExperimentParameter topo Instance of Topo topo_config Instance of TopoConfig """ - PARAMETER_CLASS = ExperienceParameter + PARAMETER_CLASS = ExperimentParameter - def __init__(self, experience_parameter_filename, topo, topo_config): + def __init__(self, experiment_parameter_filename, topo, topo_config): """ - Instantiation of this base class only load the experience parameter + Instantiation of this base class only load the experiment parameter """ - self.experience_parameter = self.__class__.PARAMETER_CLASS(experience_parameter_filename) + self.experiment_parameter = self.__class__.PARAMETER_CLASS(experiment_parameter_filename) self.topo = topo self.topo_config = topo_config def load_parameters(self): """ - Load the parameter of interest from self.experience_parameter + Load the parameter of interest from self.experiment_parameter """ # Nothing to do in the base class pass @@ -136,7 +136,7 @@ class Experience(object): """ Default function to perform the experiment. It consists into three phases: - 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 experiment takes place) - A cleaning phase through `clean()` (stopping traffic, removing generated files,...) """ self.prepare() @@ -145,11 +145,11 @@ class Experience(object): def prepare(self): """ - Prepare the environment to run the experience. + Prepare the environment to run the experiment. Typically, when you inherit from this class, you want to extend this method, while still calling this parent function. - TODO: split experience traffic and protocol configuration + TODO: split experiment traffic and protocol configuration """ self.setup_sysctl() self.run_userspace_path_manager() # TODO to move elsewhere @@ -164,7 +164,7 @@ class Experience(object): """ Function only meaningful for MPTCP and its specific scheduler """ - metric = self.experience_parameter.get(ExperienceParameter.METRIC) + metric = self.experiment_parameter.get(ExperimentParameter.METRIC) if int(metric) >= 0: self.topo.command_global( "echo {} > /sys/module/mptcp_sched_metric/parameters/metric".format(metric)) @@ -175,8 +175,8 @@ class Experience(object): """ # Only meaningful if mpTopo is instance of MultiInterfaceTopo if isinstance(self.topo, MultiInterfaceTopo): - prioPath0 = self.experience_parameter.get(ExperienceParameter.PRIO_PATH0) - prioPath1 = self.experience_parameter.get(ExperienceParameter.PRIO_PATH1) + prioPath0 = self.experiment_parameter.get(ExperimentParameter.PRIO_PATH0) + prioPath1 = self.experiment_parameter.get(ExperimentParameter.PRIO_PATH1) if not prioPath0 == prioPath1: self.topo.command_to(self.topo_config.client, "/home/mininet/iproute/ip/ip link set dev " + self.topo_config.getClientInterface(0) + " priority " + str(prioPath0)) @@ -189,11 +189,11 @@ class Experience(object): self.topo_config.getRouterInterfaceSwitch(1) + " priority " + str(prioPath1)) - backupPath0 = self.experience_parameter.get(ExperienceParameter.BACKUP_PATH0) + backupPath0 = self.experiment_parameter.get(ExperimentParameter.BACKUP_PATH0) if int(backupPath0) > 0: self.topo.command_to(self.topo_config.client, self.topo_config.interfaceBUPCommand(self.topo_config.getClientInterface(0))) self.topo.command_to(self.topo_config.router, self.topo_config.interfaceBUPCommand(self.topo_config.getRouterInterfaceSwitch(0))) - backupPath1 = self.experience_parameter.get(ExperienceParameter.BACKUP_PATH1) + backupPath1 = self.experiment_parameter.get(ExperimentParameter.BACKUP_PATH1) if int(backupPath1) > 0: self.topo.command_to(self.topo_config.client, self.topo_config.interfaceBUPCommand(self.topo_config.getClientInterface(1))) self.topo.command_to(self.topo_config.router, self.topo_config.interfaceBUPCommand(self.topo_config.getRouterInterfaceSwitch(1))) @@ -229,31 +229,31 @@ class Experience(object): self.topo.command_to(self.topo_config.router, cmd) def run_userspace_path_manager(self): - if self.experience_parameter.get(ExperienceParameter.KERNELPMC) != "netlink": + if self.experiment_parameter.get(ExperimentParameter.KERNELPMC) != "netlink": print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !") else: - upmc = self.experience_parameter.get(ExperienceParameter.USERPMC) - upmca = self.experience_parameter.get(ExperienceParameter.USERPMC_ARGS) + upmc = self.experiment_parameter.get(ExperimentParameter.USERPMC) + upmca = self.experiment_parameter.get(ExperimentParameter.USERPMC_ARGS) self.topo.command_to(self.topo_config.client, upmc + \ " " + upmca + " &>upmc.log &") - if self.experience_parameter.get(ExperienceParameter.KERNELPMS) != "netlink": + if self.experiment_parameter.get(ExperimentParameter.KERNELPMS) != "netlink": print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !") else: - upms = self.experience_parameter.get(ExperienceParameter.USERPMS) - upmsa = self.experience_parameter.get(ExperienceParameter.USERPMS_ARGS) + upms = self.experiment_parameter.get(ExperimentParameter.USERPMS) + upmsa = self.experiment_parameter.get(ExperimentParameter.USERPMS_ARGS) self.topo.command_to(self.topo_config.server, upms + \ " " + upmsa + " &>upms.log &") def cleanUserspacePM(self): - if self.experience_parameter.get(ExperienceParameter.KERNELPMC) != "netlink": + if self.experiment_parameter.get(ExperimentParameter.KERNELPMC) != "netlink": print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !") else: - upmc = self.experience_parameter.get(ExperienceParameter.USERPMC) + upmc = self.experiment_parameter.get(ExperimentParameter.USERPMC) self.topo.command_to(self.topo_config.client, "killall " + upmc) - if self.experience_parameter.get(ExperienceParameter.KERNELPMS) != "netlink": + if self.experiment_parameter.get(ExperimentParameter.KERNELPMS) != "netlink": print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !") else: - upms = self.experience_parameter.get(ExperienceParameter.USERPMS) + upms = self.experiment_parameter.get(ExperimentParameter.USERPMS) self.topo.command_to(self.topo_config.server, "killall " + upms) def runNetemAt(self): @@ -314,12 +314,12 @@ class Experience(object): def save_sysctl(self): self.sysctlBUP = {} - self._save_sysctl(ExperienceParameter.SYSCTL_KEY, self.sysctlBUP) + self._save_sysctl(ExperimentParameter.SYSCTL_KEY, self.sysctlBUP) self.sysctlBUPC = {} - self._save_sysctl(ExperienceParameter.SYSCTL_KEY_CLIENT, self.sysctlBUPC, + self._save_sysctl(ExperimentParameter.SYSCTL_KEY_CLIENT, self.sysctlBUPC, ns = True, who = self.topo_config.client) self.sysctlBUPS = {} - self._save_sysctl(ExperienceParameter.SYSCTL_KEY_SERVER, self.sysctlBUPS, + self._save_sysctl(ExperimentParameter.SYSCTL_KEY_SERVER, self.sysctlBUPS, ns = True, who = self.topo_config.server) def _save_sysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): @@ -349,16 +349,16 @@ class Experience(object): return s def write_sysctl(self): - self._write_sysctl(ExperienceParameter.SYSCTL_KEY, self.sysctlBUP) - self._write_sysctl(ExperienceParameter.SYSCTL_KEY_CLIENT, self.sysctlBUPC, + self._write_sysctl(ExperimentParameter.SYSCTL_KEY, self.sysctlBUP) + self._write_sysctl(ExperimentParameter.SYSCTL_KEY_CLIENT, self.sysctlBUPC, ns = True, who = self.topo_config.client) - self._write_sysctl(ExperienceParameter.SYSCTL_KEY_SERVER, self.sysctlBUPS, + self._write_sysctl(ExperimentParameter.SYSCTL_KEY_SERVER, self.sysctlBUPS, ns = True, who = self.topo_config.server) def _write_sysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): for k in sysctlBUP: SYSCTL_KEY = sysctlDic[k] - sysctlValue = self.experience_parameter.get(k) + sysctlValue = self.experiment_parameter.get(k) cmd = self.cmd_write_sysctl(SYSCTL_KEY,sysctlValue) if not ns: val = self.topo.command_global(cmd) @@ -369,10 +369,10 @@ class Experience(object): def backUpSysctl(self): - self._backUpSysctl(ExperienceParameter.SYSCTL_KEY, self.sysctlBUP) - self._backUpSysctl(ExperienceParameter.SYSCTL_KEY_CLIENT, self.sysctlBUPC, + self._backUpSysctl(ExperimentParameter.SYSCTL_KEY, self.sysctlBUP) + self._backUpSysctl(ExperimentParameter.SYSCTL_KEY_CLIENT, self.sysctlBUPC, ns = True, who = self.topo_config.client) - self._backUpSysctl(ExperienceParameter.SYSCTL_KEY_SERVER, self.sysctlBUPS, + self._backUpSysctl(ExperimentParameter.SYSCTL_KEY_SERVER, self.sysctlBUPS, ns = True, who = self.topo_config.server) @@ -392,9 +392,9 @@ class Experience(object): def runTcpDump(self): #todo : replace filename by cst - cpcap = self.experience_parameter.get(ExperienceParameter.CLIENT_PCAP) - spcap = self.experience_parameter.get(ExperienceParameter.SERVER_PCAP) - snaplenpcap = self.experience_parameter.get(ExperienceParameter.SNAPLEN_PCAP) + cpcap = self.experiment_parameter.get(ExperimentParameter.CLIENT_PCAP) + spcap = self.experiment_parameter.get(ExperimentParameter.SERVER_PCAP) + snaplenpcap = self.experiment_parameter.get(ExperimentParameter.SNAPLEN_PCAP) if cpcap == "yes" : self.topo.command_to(self.topo_config.client, "tcpdump -i any -s " + snaplenpcap + " -w client.pcap &") @@ -405,46 +405,46 @@ class Experience(object): self.topo.command_to(self.topo_config.client,"sleep 5") -class RandomFileParameter(ExperienceParameter): +class RandomFileParameter(ExperimentParameter): """ - Parameters for the RandomFileExperience + Parameters for the RandomFileExperiment """ FILE = "file" # file to fetch; if random, we create a file with random data called random. RANDOM_SIZE = "file_size" # in KB - def __init__(self, experience_parameter_filename): - super(RandomFileParameter, self).__init__(experience_parameter_filename) + def __init__(self, experiment_parameter_filename): + super(RandomFileParameter, self).__init__(experiment_parameter_filename) self.default_parameters.update({ RandomFileParameter.FILE: "random", RandomFileParameter.RANDOM_SIZE: "1024", }) -class RandomFileExperience(Experience): +class RandomFileExperiment(Experiment): """ - Enable a experience to use random files + Enable a experiment to use random files This class is not directly instantiable """ PARAMETER_CLASS = RandomFileParameter - def __init__(self, experience_parameter_filename, topo, topo_config): - super(RandomFileExperience, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(RandomFileExperiment, self).__init__(experiment_parameter_filename, topo, topo_config) self.load_parameters() self.ping() def load_parameters(self): - super(RandomFileExperience, self).load_parameters() - self.file = self.experience_parameter.get(RandomFileParameter.FILE) - self.random_size = self.experience_parameter.get(RandomFileParameter.RANDOM_SIZE) + super(RandomFileExperiment, self).load_parameters() + self.file = self.experiment_parameter.get(RandomFileParameter.FILE) + self.random_size = self.experiment_parameter.get(RandomFileParameter.RANDOM_SIZE) def prepare(self): - super(RandomFileExperience, self).prepare() + super(RandomFileExperiment, self).prepare() if self.file == "random": self.topo.command_to(self.topo_config.client, "dd if=/dev/urandom of=random bs=1K count={}".format(self.random_size)) def clean(self): - super(RandomFileExperience, self).clean() + super(RandomFileExperiment, self).clean() if self.file == "random": self.topo.command_to(self.topo_config.client, "rm random*") diff --git a/experiences/none.py b/experiences/none.py deleted file mode 100644 index fc8bd47..0000000 --- a/experiences/none.py +++ /dev/null @@ -1,16 +0,0 @@ -from core.experience import Experience, ExperienceParameter - -class NoneExperience(Experience): - NAME = "none" - - def __init__(self, experience_parameter_filename, topo, topo_config): - super(NoneExperience, self).__init__(experience_parameter_filename, topo, topo_config) - - def prepare(self): - Experience.prepare(self) - - def clean(self): - Experience.clean(self) - - def run(self): - self.topo.get_cli() diff --git a/experiences/__init__.py b/experiments/__init__.py similarity index 75% rename from experiences/__init__.py rename to experiments/__init__.py index 4d3317d..ab03980 100644 --- a/experiences/__init__.py +++ b/experiments/__init__.py @@ -2,20 +2,20 @@ import importlib import pkgutil import os -from core.experience import Experience +from core.experiment import Experiment pkg_dir = os.path.dirname(__file__) for (module_loader, name, ispkg) in pkgutil.iter_modules([pkg_dir]): importlib.import_module('.' + name, __package__) # Track direct inheritance -EXPERIENCES = {} +EXPERIMENTS = {} def _get_all_subclasses(BaseClass): for cls in BaseClass.__subclasses__(): if hasattr(cls, "NAME"): - EXPERIENCES[cls.NAME] = cls + EXPERIMENTS[cls.NAME] = cls _get_all_subclasses(cls) -_get_all_subclasses(Experience) \ No newline at end of file +_get_all_subclasses(Experiment) \ No newline at end of file diff --git a/experiences/ab.py b/experiments/ab.py similarity index 80% rename from experiences/ab.py rename to experiments/ab.py index abf0388..5b906e2 100644 --- a/experiences/ab.py +++ b/experiments/ab.py @@ -1,4 +1,4 @@ -from core.experience import RandomFileExperience, RandomFileParameter, ExperienceParameter +from core.experiment import RandomFileExperiment, RandomFileParameter, ExperimentParameter import os @@ -6,15 +6,15 @@ class ABParameter(RandomFileParameter): CONCURRENT_REQUESTS = "abConccurentRequests" TIME_LIMIT = "abTimelimit" - def __init__(self, experience_parameter_filename): - super(ABParameter, self).__init__(experience_parameter_filename) + def __init__(self, experiment_parameter_filename): + super(ABParameter, self).__init__(experiment_parameter_filename) self.default_parameters.update({ ABParameter.CONCURRENT_REQUESTS: "50", ABParameter.TIME_LIMIT: "20", }) -class AB(RandomFileExperience): +class AB(RandomFileExperiment): NAME = "ab" PARAMETER_CLASS = ABParameter @@ -23,13 +23,13 @@ class AB(RandomFileExperience): AB_BIN = "ab" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): - super(AB, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(AB, self).__init__(experiment_parameter_filename, topo, topo_config) def ping(self): self.topo.command_to(self.topo_config.client, "rm " + AB.PING_OUTPUT) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) @@ -43,8 +43,8 @@ class AB(RandomFileExperience): def load_parameters(self): super(AB, self).load_parameters() - self.concurrent_requests = self.experience_parameter.get(ABParameter.CONCURRENT_REQUESTS) - self.time_limit = self.experience_parameter.get(ABParameter.TIME_LIMIT) + self.concurrent_requests = self.experiment_parameter.get(ABParameter.CONCURRENT_REQUESTS) + self.time_limit = self.experiment_parameter.get(ABParameter.TIME_LIMIT) def prepare(self): super(AB, self).prepare() diff --git a/experiences/ditg.py b/experiments/ditg.py similarity index 81% rename from experiences/ditg.py rename to experiments/ditg.py index e47616e..26ff340 100644 --- a/experiences/ditg.py +++ b/experiments/ditg.py @@ -1,8 +1,8 @@ -from core.experience import Experience, ExperienceParameter +from core.experiment import Experiment, ExperimentParameter import os -class DITGParameter(ExperienceParameter): +class DITGParameter(ExperimentParameter): KBYTES = "ditgKBytes" CONSTANT_PACKET_SIZE = "ditgConstantPacketSize" MEAN_POISSON_PACKETS_SEC = "ditgMeanPoissonPacketsSec" @@ -10,8 +10,8 @@ class DITGParameter(ExperienceParameter): BURSTS_ON_PACKETS_SEC = "ditgBurstsOnPacketsSec" BURSTS_OFF_PACKETS_SEC = "ditgBurstsOffPacketsSec" - def __init__(self, experience_parameter_filename): - super(DITGParameter, self).__init__(experience_parameter_filename) + def __init__(self, experiment_parameter_filename): + super(DITGParameter, self).__init__(experiment_parameter_filename) self.default_parameters.update({ DITGParameter.KBYTES: "10000", DITGParameter.CONSTANT_PACKET_SIZE: "1428", @@ -22,7 +22,7 @@ class DITGParameter(ExperienceParameter): }) -class DITG(Experience): +class DITG(Experiment): NAME = "ditg" PARAMETER_CLASS = DITGParameter @@ -36,15 +36,15 @@ class DITG(Experience): PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): - super(DITG, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(DITG, self).__init__(experiment_parameter_filename, topo, topo_config) self.load_parameters() self.ping() def ping(self): self.topo.command_to(self.topo_config.client, "rm " + \ - Experience.PING_OUTPUT) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + Experiment.PING_OUTPUT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) @@ -57,12 +57,12 @@ class DITG(Experience): return s def load_parameters(self): - self.kbytes = self.experience_parameter.get(DITGParameter.KBYTES) - self.constant_packet_size = self.experience_parameter.get(DITGParameter.CONSTANT_PACKET_SIZE) - self.mean_poisson_packets_sec = self.experience_parameter.get(DITGParameter.MEAN_POISSON_PACKETS_SEC) - self.constant_packets_sec = self.experience_parameter.get(DITGParameter.CONSTANT_PACKETS_SEC) - self.bursts_on_packets_sec = self.experience_parameter.get(DITGParameter.BURSTS_ON_PACKETS_SEC) - self.bursts_off_packets_sec = self.experience_parameter.get(DITGParameter.BURSTS_OFF_PACKETS_SEC) + self.kbytes = self.experiment_parameter.get(DITGParameter.KBYTES) + self.constant_packet_size = self.experiment_parameter.get(DITGParameter.CONSTANT_PACKET_SIZE) + self.mean_poisson_packets_sec = self.experiment_parameter.get(DITGParameter.MEAN_POISSON_PACKETS_SEC) + self.constant_packets_sec = self.experiment_parameter.get(DITGParameter.CONSTANT_PACKETS_SEC) + self.bursts_on_packets_sec = self.experiment_parameter.get(DITGParameter.BURSTS_ON_PACKETS_SEC) + self.bursts_off_packets_sec = self.experiment_parameter.get(DITGParameter.BURSTS_OFF_PACKETS_SEC) def prepare(self): super(DITG, self).prepare() diff --git a/experiences/epload.py b/experiments/epload.py similarity index 85% rename from experiences/epload.py rename to experiments/epload.py index 4e16993..16bdef7 100644 --- a/experiences/epload.py +++ b/experiments/epload.py @@ -1,17 +1,17 @@ -from core.experience import Experience, ExperienceParameter +from core.experiment import Experiment, ExperimentParameter import os -class EploadParameter(ExperienceParameter): +class EploadParameter(ExperimentParameter): TEST_DIR = "test_dir" - def __init__(self, experience_parameter_filename): - super(EploadParameter, self).__init__(experience_parameter_filename) + def __init__(self, experiment_parameter_filename): + super(EploadParameter, self).__init__(experiment_parameter_filename) self.default_parameters.update({ TEST_DIR: "/bla/bla/bla", }) -class Epload(Experience): +class Epload(Experiment): NAME = "epload" PARAMETER_CLASS = EploadParameter @@ -21,15 +21,15 @@ class Epload(Experience): EPLOAD_EMULATOR="/home/mininet/epload/epload/emulator/run.js" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): - super(Epload, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(Epload, self).__init__(experiment_parameter_filename, topo, topo_config) self.load_parameters() self.ping() def ping(self): self.topo.command_to(self.topo_config.client, "rm " + \ Epload.PING_OUTPUT ) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) @@ -42,7 +42,7 @@ class Epload(Experience): return s def load_parameters(self): - self.test_dir = self.experience_parameter.get(EploadParameter.TEST_DIR) + self.test_dir = self.experiment_parameter.get(EploadParameter.TEST_DIR) def prepare(self): super(Epload, self).prepare() diff --git a/experiences/http.py b/experiments/http.py similarity index 88% rename from experiences/http.py rename to experiments/http.py index 60f89a7..30a20c4 100644 --- a/experiences/http.py +++ b/experiments/http.py @@ -1,7 +1,7 @@ -from core.experience import ExperienceParameter, RandomFileExperience, RandomFileParameter +from core.experiment import ExperimentParameter, RandomFileExperiment, RandomFileParameter import os -class HTTP(RandomFileExperience): +class HTTP(RandomFileExperiment): NAME = "http" SERVER_LOG = "http_server.log" @@ -9,14 +9,14 @@ class HTTP(RandomFileExperience): WGET_BIN = "wget" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): + def __init__(self, experiment_parameter_filename, topo, topo_config): # Just rely on RandomFileExperiment - super(HTTP, self).__init__(experience_parameter_filename, topo, topo_config) + super(HTTP, self).__init__(experiment_parameter_filename, topo, topo_config) def ping(self): self.topo.command_to(self.topo_config.client, "rm " + \ HTTP.PING_OUTPUT ) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) diff --git a/experiences/https.py b/experiments/https.py similarity index 89% rename from experiences/https.py rename to experiments/https.py index 062531e..ce496ca 100644 --- a/experiences/https.py +++ b/experiments/https.py @@ -1,7 +1,7 @@ -from core.experience import ExperienceParameter, RandomFileExperience, RandomFileParameter +from core.experiment import ExperimentParameter, RandomFileExperiment, RandomFileParameter import os -class HTTPS(RandomFileExperience): +class HTTPS(RandomFileExperiment): NAME = "https" SERVER_LOG = "https_server.log" @@ -9,14 +9,14 @@ class HTTPS(RandomFileExperience): WGET_BIN = "wget" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): + def __init__(self, experiment_parameter_filename, topo, topo_config): # Just rely on RandomFileExperiment - super(HTTPS, self).__init__(experience_parameter_filename, topo, topo_config) + super(HTTPS, self).__init__(experiment_parameter_filename, topo, topo_config) def ping(self): self.topo.command_to(self.topo_config.client, "rm " + \ HTTPS.PING_OUTPUT ) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) diff --git a/experiences/iperf.py b/experiments/iperf.py similarity index 78% rename from experiences/iperf.py rename to experiments/iperf.py index a2146e3..250b140 100644 --- a/experiences/iperf.py +++ b/experiments/iperf.py @@ -1,18 +1,18 @@ -from core.experience import Experience, ExperienceParameter +from core.experiment import Experiment, ExperimentParameter import os -class IPerfParameter(ExperienceParameter): +class IPerfParameter(ExperimentParameter): TIME = "iperfTime" PARALLEL = "iperfParallel" - def __init__(self, experience_parameter_filename): - super(IPerfParameter, self).__init__(experience_parameter_filename) + def __init__(self, experiment_parameter_filename): + super(IPerfParameter, self).__init__(experiment_parameter_filename) self.default_parameters.update({ IPerfParameter.TIME: "10", IPerfParameter.PARALLEL: "1", }) -class IPerf(Experience): +class IPerf(Experiment): NAME = "iperf" PARAMETER_CLASS = IPerfParameter @@ -21,15 +21,15 @@ class IPerf(Experience): IPERF_BIN = "iperf3" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): - super(IPerf, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(IPerf, self).__init__(experiment_parameter_filename, topo, topo_config) self.load_parameters() self.ping() def ping(self): self.topo.command_to(self.topo_config.client, "rm " + \ IPerf.PING_OUTPUT) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) @@ -42,8 +42,8 @@ class IPerf(Experience): return s def load_parameters(self): - self.time = self.experience_parameter.get(IPerfParameter.TIME) - self.parallel = self.experience_parameter.get(IPerfParameter.PARALLEL) + self.time = self.experiment_parameter.get(IPerfParameter.TIME) + self.parallel = self.experiment_parameter.get(IPerfParameter.PARALLEL) def prepare(self): super(IPerf, self).prepare() diff --git a/experiences/msg.py b/experiments/msg.py similarity index 81% rename from experiences/msg.py rename to experiments/msg.py index 9a6a073..ccf5b86 100644 --- a/experiences/msg.py +++ b/experiments/msg.py @@ -1,15 +1,15 @@ -from core.experience import Experience, ExperienceParameter +from core.experiment import Experiment, ExperimentParameter import os -class MsgParameter(ExperienceParameter): +class MsgParameter(ExperimentParameter): CLIENT_SLEEP = "msgClientSleep" SERVER_SLEEP = "msgServerSleep" NB_REQUESTS = "msgNbRequests" BYTES = "msgBytes" - def __init__(self, experience_parameter_filename): - super(MsgParameter, self).__init__(experience_parameter_filename) + def __init__(self, experiment_parameter_filename): + super(MsgParameter, self).__init__(experiment_parameter_filename) self.default_parameters.update({ MsgParameter.CLIENT_SLEEP: "5.0", MsgParameter.SERVER_SLEEP: "5.0", @@ -17,7 +17,7 @@ class MsgParameter(ExperienceParameter): MsgParameter.BYTES: "1200", }) -class Msg(Experience): +class Msg(Experiment): NAME = "msg" PARAMETER_CLASS = MsgParameter @@ -26,15 +26,15 @@ class Msg(Experience): CLIENT_ERR = "msg_client.err" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): - super(Msg, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(Msg, self).__init__(experiment_parameter_filename, topo, topo_config) self.load_parameters() self.ping() def ping(self): self.topo.command_to(self.topo_config.client, "rm " + \ Msg.PING_OUTPUT ) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) @@ -47,10 +47,10 @@ class Msg(Experience): return s def load_parameters(self): - self.client_sleep = self.experience_parameter.get(MsgParameter.CLIENT_SLEEP) - self.server_sleep = self.experience_parameter.get(MsgParameter.SERVER_SLEEP) - self.nb_requests = self.experience_parameter.get(MsgParameter.NB_REQUESTS) - self.bytes = self.experience_parameter.get(MsgParameter.BYTES) + self.client_sleep = self.experiment_parameter.get(MsgParameter.CLIENT_SLEEP) + self.server_sleep = self.experiment_parameter.get(MsgParameter.SERVER_SLEEP) + self.nb_requests = self.experiment_parameter.get(MsgParameter.NB_REQUESTS) + self.bytes = self.experiment_parameter.get(MsgParameter.BYTES) def prepare(self): super(Msg, self).prepare() diff --git a/experiences/nc.py b/experiments/nc.py similarity index 72% rename from experiences/nc.py rename to experiments/nc.py index 96dadf1..ae1506f 100644 --- a/experiences/nc.py +++ b/experiments/nc.py @@ -1,19 +1,19 @@ -from core.experience import Experience, ExperienceParameter +from core.experiment import Experiment, ExperimentParameter """ -Should be the mother of ExperienceNCPV, shame on me, should rewrite -ExperienceNCPV as daughter class of this one. +Should be the mother of ExperimentNCPV, shame on me, should rewrite +ExperimentNCPV as daughter class of this one. """ -class NCParameter(ExperienceParameter): +class NCParameter(ExperimentParameter): DD_IBS = "ddIBS" DD_OBS = "ddIBS" DD_COUNT = "ddCount" SERVER_PORT = "ncServerPort" CLIENT_PORT = "ncClientPort" - def __init__(self, experience_parameter_filename): - super(NCParameter, self).__init__(experience_parameter_filename) + def __init__(self, experiment_parameter_filename): + super(NCParameter, self).__init__(experiment_parameter_filename) self.default_parameters.update({ NCParameter.DD_IBS: "1k", NCParameter.DD_OBS: "1k", @@ -23,7 +23,7 @@ class NCParameter(ExperienceParameter): }) -class NC(Experience): +class NC(Experiment): NAME = "nc" PARAMETER_CLASS = NCParameter @@ -31,22 +31,22 @@ class NC(Experience): CLIENT_NC_LOG = "netcat_client" NC_BIN = "netcat" - def __init__(self, experience_parameter_filename, topo, topo_config): - super(NC, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(NC, self).__init__(experiment_parameter_filename, topo, topo_config) self.load_parameters() def load_parameters(self): - self.ddibs = self.experience_parameter.get(NCParameter.DD_IBS) - self.ddobs = self.experience_parameter.get(NCParameter.DD_OBS) - self.ddcount = self.experience_parameter.get(NCParameter.DD_COUNT) - self.ncServerPort = self.experience_parameter.get(NCParameter.SERVER_PORT) + self.ddibs = self.experiment_parameter.get(NCParameter.DD_IBS) + self.ddobs = self.experiment_parameter.get(NCParameter.DD_OBS) + self.ddcount = self.experiment_parameter.get(NCParameter.DD_COUNT) + self.ncServerPort = self.experiment_parameter.get(NCParameter.SERVER_PORT) self.ncClientPort = [] - for k in sorted(self.experience_parameter.paramDic): + for k in sorted(self.experiment_parameter.paramDic): if k.startswith(NCParameter.CLIENT_PORT): - port = self.experience_parameter.paramDic[k] + port = self.experiment_parameter.paramDic[k] self.ncClientPort.append(port) if len(self.ncClientPort) == 0: - d = self.experience_parameter.get(NCParameter.CLIENT_PORT) + d = self.experiment_parameter.get(NCParameter.CLIENT_PORT) self.ncClientPort.append(d) def prepare(self): diff --git a/experiences/ncpv.py b/experiments/ncpv.py similarity index 87% rename from experiences/ncpv.py rename to experiments/ncpv.py index f15cf61..e777f6f 100644 --- a/experiences/ncpv.py +++ b/experiments/ncpv.py @@ -1,4 +1,4 @@ -from .nc import NC, NCParameter, ExperienceParameter +from .nc import NC, NCParameter, ExperimentParameter class NCPVParameter(NCParameter): @@ -8,8 +8,8 @@ class NCPVParameter(NCParameter): CHANGE_PV = "changePv" CHANGE_PV_AT = "changePvAt" - def __init__(self, experience_parameter_filename): - super(NCPVParameter, self).__init__(experience_parameter_filename) + def __init__(self, experiment_parameter_filename): + super(NCPVParameter, self).__init__(experiment_parameter_filename) self.default_parameters.update({ NCPVParameter.RATE_LIMIT: "400k", NCPVParameter.G: "10000", @@ -42,15 +42,15 @@ class NCPV(NC): PV_BIN = "/usr/local/bin/pv" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): - super(NCPV, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(NCPV, self).__init__(experiment_parameter_filename, topo, topo_config) self.load_parameters() self.ping() def ping(self): self.topo.command_to(self.topo_config.client, "rm " + \ NCPV.PING_OUTPUT ) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) @@ -64,18 +64,18 @@ class NCPV(NC): def load_parameters(self): super(NCPV, self).load_parameters() - self.pvg = self.experience_parameter.get(ExperienceParameter.PVG) - self.pvz = self.experience_parameter.get(ExperienceParameter.PVZ) - self.pvRateLimit = self.experience_parameter.get(ExperienceParameter.PVRATELIMIT) + self.pvg = self.experiment_parameter.get(ExperimentParameter.PVG) + self.pvz = self.experiment_parameter.get(ExperimentParameter.PVZ) + self.pvRateLimit = self.experiment_parameter.get(ExperimentParameter.PVRATELIMIT) self.loadPvAt() def loadPvAt(self): self.changePvAt = [] - self.changePv = self.experience_parameter.get(ExperienceParameter.CHANGEPV) + self.changePv = self.experiment_parameter.get(ExperimentParameter.CHANGEPV) if self.changePv != "yes": print("Don't change pv rate...") return - changePvAt = self.experience_parameter.get(ExperienceParameter.CHANGEPVAT) + changePvAt = self.experiment_parameter.get(ExperimentParameter.CHANGEPVAT) if not isinstance(changePvAt, list): changePvAt = [changePvAt] for p in changePvAt: diff --git a/experiences/netperf.py b/experiments/netperf.py similarity index 79% rename from experiences/netperf.py rename to experiments/netperf.py index edb20b3..7c2d8bd 100644 --- a/experiences/netperf.py +++ b/experiments/netperf.py @@ -1,14 +1,14 @@ -from core.experience import Experience, ExperienceParameter +from core.experiment import Experiment, ExperimentParameter import os -class NetperfParameter(ExperienceParameter): +class NetperfParameter(ExperimentParameter): TESTLEN = "netperfTestlen" TESTNAME = "netperfTestname" REQRES_SIZE = "netperfReqresSize" - def __init__(self, experience_parameter_filename): - super(NetperfParameter, self).__init__(experience_parameter_filename) + def __init__(self, experiment_parameter_filename): + super(NetperfParameter, self).__init__(experiment_parameter_filename) self.default_parameters.update({ NetperfParameter.TESTLEN: "10", NetperfParameter.TESTNAME: "TCP_RR", @@ -16,7 +16,7 @@ class NetperfParameter(ExperienceParameter): }) -class Netperf(Experience): +class Netperf(Experiment): NAME = "netperf" PARAMETER_CLASS = NetperfParameter @@ -26,15 +26,15 @@ class Netperf(Experience): NETSERVER_BIN = "netserver" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): - super(Netperf, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(Netperf, self).__init__(experiment_parameter_filename, topo, topo_config) self.load_parameters() self.ping() def ping(self): self.topo.command_to(self.topo_config.client, "rm " + \ Netperf.PING_OUTPUT) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) @@ -47,9 +47,9 @@ class Netperf(Experience): return s def load_parameters(self): - self.testlen = self.experience_parameter.get(NetperfParameter.TESTLEN) - self.testname = self.experience_parameter.get(NetperfParameter.TESTNAME) - self.reqres_size = self.experience_parameter.get(NetperfParameter.REQRES_SIZE) + self.testlen = self.experiment_parameter.get(NetperfParameter.TESTLEN) + self.testname = self.experiment_parameter.get(NetperfParameter.TESTNAME) + self.reqres_size = self.experiment_parameter.get(NetperfParameter.REQRES_SIZE) def prepare(self): super(Netperf, self).prepare() diff --git a/experiments/none.py b/experiments/none.py new file mode 100644 index 0000000..82322d3 --- /dev/null +++ b/experiments/none.py @@ -0,0 +1,16 @@ +from core.experiment import Experiment, ExperimentParameter + +class NoneExperiment(Experiment): + NAME = "none" + + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(NoneExperiment, self).__init__(experiment_parameter_filename, topo, topo_config) + + def prepare(self): + Experiment.prepare(self) + + def clean(self): + Experiment.clean(self) + + def run(self): + self.topo.get_cli() diff --git a/experiences/ping.py b/experiments/ping.py similarity index 74% rename from experiences/ping.py rename to experiments/ping.py index b41285d..31a17dc 100644 --- a/experiences/ping.py +++ b/experiments/ping.py @@ -1,12 +1,12 @@ -from core.experience import Experience, ExperienceParameter +from core.experiment import Experiment, ExperimentParameter -class Ping(Experience): +class Ping(Experiment): NAME = "ping" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): - super(Ping, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(Ping, self).__init__(experiment_parameter_filename, topo, topo_config) def prepare(self): super(Ping, self).prepare() @@ -17,7 +17,7 @@ class Ping(Experience): def run(self): self.topo.command_to(self.topo_config.client, "rm " + \ Ping.PING_OUTPUT ) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) diff --git a/experiences/quic.py b/experiments/quic.py similarity index 89% rename from experiences/quic.py rename to experiments/quic.py index 5a88fe1..fc4c768 100644 --- a/experiences/quic.py +++ b/experiments/quic.py @@ -1,19 +1,19 @@ -from core.experience import RandomFileExperience, RandomFileParameter, ExperienceParameter +from core.experiment import RandomFileExperiment, RandomFileParameter, ExperimentParameter from topos.multi_interface_cong import MultiInterfaceCongConfig import os -class QUICParameter(RandomFileExperience): +class QUICParameter(RandomFileExperiment): MULTIPATH = "quicMultipath" - def __init__(self, experience_parameter_filename): - super(QUICParameter, self).__init__(experience_parameter_filename) + def __init__(self, experiment_parameter_filename): + super(QUICParameter, self).__init__(experiment_parameter_filename) self.default_parameters.update({ QUICParameter.MULTIPATH: "0", }) -class QUIC(RandomFileExperience): +class QUIC(RandomFileExperiment): NAME = "quic" PARAMETER_CLASS = QUICParameter @@ -26,14 +26,14 @@ class QUIC(RandomFileExperience): CERTPATH = "~/go/src/github.com/lucas-clemente/quic-go/example/" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): - # Just rely on RandomFileExperience - super(QUIC, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + # Just rely on RandomFileExperiment + super(QUIC, self).__init__(experiment_parameter_filename, topo, topo_config) def ping(self): self.topo.command_to(self.topo_config.client, "rm " + \ QUIC.PING_OUTPUT ) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) @@ -47,7 +47,7 @@ class QUIC(RandomFileExperience): def load_parameters(self): super(QUIC, self).load_parameters() - self.multipath = self.experience_parameter.get(QUICParameter.MULTIPATH) + self.multipath = self.experiment_parameter.get(QUICParameter.MULTIPATH) def prepare(self): super(QUIC, self).prepare() diff --git a/experiences/quic_siri.py b/experiments/quic_siri.py similarity index 84% rename from experiences/quic_siri.py rename to experiments/quic_siri.py index d47dbdf..10d2642 100644 --- a/experiences/quic_siri.py +++ b/experiments/quic_siri.py @@ -1,19 +1,19 @@ -from core.experience import Experience, ExperienceParameter +from core.experiment import Experiment, ExperimentParameter import os -class QUICSiriParameter(ExperienceParameter): +class QUICSiriParameter(ExperimentParameter): MULTIPATH = "quicMultipath" RUN_TIME = "quicSiriRunTime" - def __init__(self, experience_parameter_filename): - super(QUICSiriParameter, self).__init__(experience_parameter_filename) + def __init__(self, experiment_parameter_filename): + super(QUICSiriParameter, self).__init__(experiment_parameter_filename) self.default_parameters.update({ QUICSiriParameter.MULTIPATH: "0", }) -class QUICSiri(Experience): +class QUICSiri(Experiment): NAME = "quicsiri" PARAMETER_CLASS = QUICSiriParameter @@ -24,15 +24,15 @@ class QUICSiri(Experience): SERVER_GO_FILE = "~/go/src/github.com/lucas-clemente/quic-go/example/siri/siri.go" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): - super(QUICSiri, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(QUICSiri, self).__init__(experiment_parameter_filename, topo, topo_config) self.load_parameters() self.ping() def ping(self): self.topo.command_to(self.topo_config.client, "rm " + \ QUICSiri.PING_OUTPUT ) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) @@ -45,8 +45,8 @@ class QUICSiri(Experience): return s def load_parameters(self): - self.run_time = self.experience_parameter.get(QUICSiriParameter.RUN_TIME) - self.multipath = self.experience_parameter.get(QUICSiriParameter.MULTIPATH) + self.run_time = self.experiment_parameter.get(QUICSiriParameter.RUN_TIME) + self.multipath = self.experiment_parameter.get(QUICSiriParameter.MULTIPATH) def prepare(self): super(QUICSiri, self).prepare() diff --git a/experiences/send_file.py b/experiments/send_file.py similarity index 83% rename from experiences/send_file.py rename to experiments/send_file.py index 24aeb40..6909992 100644 --- a/experiences/send_file.py +++ b/experiments/send_file.py @@ -1,7 +1,7 @@ -from core.experience import RandomFileExperience, RandomFileParameter, ExperienceParameter +from core.experiment import RandomFileExperiment, RandomFileParameter, ExperimentParameter import os -class SendFile(RandomFileExperience): +class SendFile(RandomFileExperiment): NAME = "sendfile" SERVER_LOG = "sendfile_server.log" @@ -9,14 +9,14 @@ class SendFile(RandomFileExperience): WGET_BIN = "./client" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): - # Just rely on RandomFileExperience - super(SendFile, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + # Just rely on RandomFileExperiment + super(SendFile, self).__init__(experiment_parameter_filename, topo, topo_config) def ping(self): self.topo.command_to(self.topo_config.client, "rm " + \ SendFile.PING_OUTPUT ) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) diff --git a/experiences/siri.py b/experiments/siri.py similarity index 78% rename from experiences/siri.py rename to experiments/siri.py index 92f8eef..26e37e0 100644 --- a/experiences/siri.py +++ b/experiments/siri.py @@ -1,8 +1,8 @@ -from core.experience import Experience, ExperienceParameter +from core.experiment import Experiment, ExperimentParameter import os -class SiriParameter(ExperienceParameter): +class SiriParameter(ExperimentParameter): RUN_TIME = "siriRunTime" QUERY_SIZE = "siriQuerySize" RESPONSE_SIZE = "siriResponseSize" @@ -14,8 +14,8 @@ class SiriParameter(ExperienceParameter): BURST_SIZE = "siriBurstSize" INTERVAL_BURST_TIME_MS = "siriIntervalBurstTimeMs" - def __init__(self, experience_parameter_filename): - super(SiriParameter, self).__init__(experience_parameter_filename) + def __init__(self, experiment_parameter_filename): + super(SiriParameter, self).__init__(experiment_parameter_filename) self.default_parameters.update({ SiriParameter.QUERY_SIZE: "2500", SiriParameter.RESPONSE_SIZE: "750", @@ -29,7 +29,7 @@ class SiriParameter(ExperienceParameter): }) -class Siri(Experience): +class Siri(Experiment): NAME = "siri" PARAMETER_CLASS = SiriParameter @@ -39,15 +39,15 @@ class Siri(Experience): JAVA_BIN = "java" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): - super(Siri, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(Siri, self).__init__(experiment_parameter_filename, topo, topo_config) self.load_parameters() self.ping() def ping(self): self.topo.command_to(self.topo_config.client, "rm " + \ Siri.PING_OUTPUT ) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) @@ -60,16 +60,16 @@ class Siri(Experience): return s def load_parameters(self): - self.run_time = self.experience_parameter.get(SiriParameter.RUN_TIME) - self.query_size = self.experience_parameter.get(SiriParameter.QUERY_SIZE) - self.response_size = self.experience_parameter.get(SiriParameter.RESPONSE_SIZE) - self.delay_query_response = self.experience_parameter.get(SiriParameter.DELAY_QUERY_RESPONSE) - self.min_payload_size = self.experience_parameter.get(SiriParameter.MIN_PAYLOAD_SIZE) - self.max_payload_size = self.experience_parameter.get(SiriParameter.MAX_PAYLOAD_SIZE) - self.interval_time_ms = self.experience_parameter.get(SiriParameter.INTERVAL_TIME_MS) - self.buffer_size = self.experience_parameter.get(SiriParameter.BUFFER_SIZE) - self.burst_size = self.experience_parameter.get(SiriParameter.BURST_SIZE) - self.interval_burst_time_ms = self.experience_parameter.get(SiriParameter.INTERVAL_BURST_TIME_MS) + self.run_time = self.experiment_parameter.get(SiriParameter.RUN_TIME) + self.query_size = self.experiment_parameter.get(SiriParameter.QUERY_SIZE) + self.response_size = self.experiment_parameter.get(SiriParameter.RESPONSE_SIZE) + self.delay_query_response = self.experiment_parameter.get(SiriParameter.DELAY_QUERY_RESPONSE) + self.min_payload_size = self.experiment_parameter.get(SiriParameter.MIN_PAYLOAD_SIZE) + self.max_payload_size = self.experiment_parameter.get(SiriParameter.MAX_PAYLOAD_SIZE) + self.interval_time_ms = self.experiment_parameter.get(SiriParameter.INTERVAL_TIME_MS) + self.buffer_size = self.experiment_parameter.get(SiriParameter.BUFFER_SIZE) + self.burst_size = self.experiment_parameter.get(SiriParameter.BURST_SIZE) + self.interval_burst_time_ms = self.experiment_parameter.get(SiriParameter.INTERVAL_BURST_TIME_MS) def prepare(self): super(Siri, self).prepare() diff --git a/experiences/siri_http.py b/experiments/siri_http.py similarity index 90% rename from experiences/siri_http.py rename to experiments/siri_http.py index 4e034d3..84d304e 100644 --- a/experiences/siri_http.py +++ b/experiments/siri_http.py @@ -1,8 +1,8 @@ -from core.experience import ExperienceParameter, RandomFileExperience, RandomFileParameter +from core.experiment import ExperimentParameter, RandomFileExperiment, RandomFileParameter from .siri import Siri import os -class SiriHTTP(Siri, RandomFileExperience): +class SiriHTTP(Siri, RandomFileExperiment): NAME = "sirihttp" HTTP_SERVER_LOG = "http_server.log" @@ -14,14 +14,14 @@ class SiriHTTP(Siri, RandomFileExperience): JAVA_BIN = "java" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): + def __init__(self, experiment_parameter_filename, topo, topo_config): # Just rely on RandomFileExperiment - super(SiriHTTP, self).__init__(experience_parameter_filename, topo, topo_config) + super(SiriHTTP, self).__init__(experiment_parameter_filename, topo, topo_config) def ping(self): self.topo.command_to(self.topo_config.client, "rm " + \ SiriHTTP.PING_OUTPUT ) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) diff --git a/experiences/siri_msg.py b/experiments/siri_msg.py similarity index 92% rename from experiences/siri_msg.py rename to experiments/siri_msg.py index d8e89a7..6401acf 100644 --- a/experiences/siri_msg.py +++ b/experiments/siri_msg.py @@ -1,4 +1,4 @@ -from core.experience import ExperienceParameter +from core.experiment import ExperimentParameter from .siri import Siri, SiriParameter from .msg import Msg, MsgParameter import os @@ -25,8 +25,8 @@ class SiriMsg(Siri, Msg): JAVA_BIN = "java" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): - super(SiriMsg, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(SiriMsg, self).__init__(experiment_parameter_filename, topo, topo_config) def load_parameters(self): # Fetch both Msg and Siri parameters diff --git a/experiences/vlc.py b/experiments/vlc.py similarity index 82% rename from experiences/vlc.py rename to experiments/vlc.py index 74b09d6..0d42b9b 100644 --- a/experiences/vlc.py +++ b/experiments/vlc.py @@ -1,19 +1,19 @@ -from core.experience import Experience, ExperienceParameter +from core.experiment import Experiment, ExperimentParameter import os -class VLCParameter(ExperienceParameter): +class VLCParameter(ExperimentParameter): FILE = "vlcFile" TIME = "vlcTime" - def __init__(self, experience_parameter_filename): - super(VLCParameter, self).__init__(experience_parameter_filename) + def __init__(self, experiment_parameter_filename): + super(VLCParameter, self).__init__(experiment_parameter_filename) self.default_parameters.update({ VLCParameter.FILE: "bunny_ibmff_360.mpd", VLCParameter.TIME: "0", }) -class VLC(Experience): +class VLC(Experiment): NAME = "vlc" SERVER_LOG = "vlc_server.log" @@ -21,15 +21,15 @@ class VLC(Experience): VLC_BIN = "/home/mininet/vlc/vlc" PING_OUTPUT = "ping.log" - def __init__(self, experience_parameter_filename, topo, topo_config): - super(VLC, self).__init__(experience_parameter_filename, topo, topo_config) + def __init__(self, experiment_parameter_filename, topo, topo_config): + super(VLC, self).__init__(experiment_parameter_filename, topo, topo_config) self.load_parameters() self.ping() def ping(self): self.topo.command_to(self.topo_config.client, "rm " + \ VLC.PING_OUTPUT ) - count = self.experience_parameter.get(ExperienceParameter.PING_COUNT) + count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) for i in range(0, self.topo_config.getClientInterfaceCount()): cmd = self.pingCommand(self.topo_config.getClientIP(i), self.topo_config.getServerIP(), n = count) @@ -42,8 +42,8 @@ class VLC(Experience): return s def load_parameters(self): - self.file = self.experience_parameter.get(VLCParameter.FILE) - self.time = self.experience_parameter.get(VLCParameter.TIME) + self.file = self.experiment_parameter.get(VLCParameter.FILE) + self.time = self.experiment_parameter.get(VLCParameter.TIME) def prepare(self): super(VLC, self).prepare() diff --git a/runner.py b/runner.py index e442214..f161c10 100644 --- a/runner.py +++ b/runner.py @@ -1,11 +1,11 @@ #!/usr/bin/python -from core.experience import Experience, ExperienceParameter, ExperienceParameter +from core.experiment import Experiment, ExperimentParameter, ExperimentParameter from core.topo import Topo, TopoParameter from mininet_builder import MininetBuilder -from experiences import EXPERIENCES +from experiments import EXPERIMENTS from topos import TOPO_CONFIGS, TOPOS import logging @@ -13,19 +13,19 @@ import logging class Runner(object): """ - Run an experiment described by `experience_parameter_file` in the topology + Run an experiment described by `experiment_parameter_file` in the topology described by `topo_parameter_file` in the network environment built by `builder_type`. All the operations are done when calling the constructor. """ - def __init__(self, builder_type, topo_parameter_file, experience_parameter_file): + def __init__(self, builder_type, topo_parameter_file, experiment_parameter_file): self.topo_parameter = TopoParameter(topo_parameter_file) self.set_builder(builder_type) self.set_topo() self.set_topo_config() self.start_topo() - self.run_experience(experience_parameter_file) + self.run_experiment(experiment_parameter_file) self.stop_topo() def set_builder(self, builder_type): @@ -68,17 +68,17 @@ class Runner(object): self.topo.start_network() self.topo_config.configure_network() - def run_experience(self, experience_parameter_file): + def run_experiment(self, experiment_parameter_file): """ Match the name of the experiement and launch it """ - # Well, we need to load twice the experience parameters, is it really annoying? - xp = ExperienceParameter(experience_parameter_file).get(ExperienceParameter.XP_TYPE) - if xp in EXPERIENCES: - exp = EXPERIENCES[xp](experience_parameter_file, self.topo, self.topo_config) + # Well, we need to load twice the experiment parameters, is it really annoying? + xp = ExperimentParameter(experiment_parameter_file).get(ExperimentParameter.XP_TYPE) + if xp in EXPERIMENTS: + exp = EXPERIMENTS[xp](experiment_parameter_file, self.topo, self.topo_config) exp.classic_run() else: - raise Exception("Unknown experience {}".format(xp)) + raise Exception("Unknown experiment {}".format(xp)) def stop_topo(self): """ @@ -95,12 +95,12 @@ if __name__ == '__main__': parser.add_argument("--topo_param_file", "-t", required=True, help="path to the topo parameter file") - parser.add_argument("--experience_param_file", "-x", - help="path to the experience parameter file") + parser.add_argument("--experiment_param_file", "-x", + help="path to the experiment parameter file") args = parser.parse_args() logging.basicConfig(level=logging.INFO) # XXX Currently, there is no alternate topo builder... - Runner(Topo.MININET_BUILDER, args.topo_param_file, args.experience_param_file) \ No newline at end of file + Runner(Topo.MININET_BUILDER, args.topo_param_file, args.experiment_param_file) \ No newline at end of file