cleanup of iperf experiment
This commit is contained in:
parent
fa2c16c52e
commit
98b4a63704
@ -55,7 +55,7 @@ class DITG(Experiment):
|
|||||||
self.topo.command_to(self.topo_config.server, "rm " + DITG.DITG_SERVER_LOG)
|
self.topo.command_to(self.topo_config.server, "rm " + DITG.DITG_SERVER_LOG)
|
||||||
self.topo.command_to(self.topo_config.client, "rm " + DITG.DITG_TEMP_LOG)
|
self.topo.command_to(self.topo_config.client, "rm " + DITG.DITG_TEMP_LOG)
|
||||||
|
|
||||||
def getClientCmd(self):
|
def get_client_cmd(self):
|
||||||
s = DITG.ITGSEND_BIN + " -a " + self.topo_config.get_server_ip() + \
|
s = DITG.ITGSEND_BIN + " -a " + self.topo_config.get_server_ip() + \
|
||||||
" -T TCP -k " + self.kbytes + " -l " + DITG.DITG_TEMP_LOG
|
" -T TCP -k " + self.kbytes + " -l " + DITG.DITG_TEMP_LOG
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ class DITG(Experiment):
|
|||||||
print(s)
|
print(s)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def getServerCmd(self):
|
def get_server_cmd(self):
|
||||||
s = DITG.ITGRECV_BIN + " -l " + DITG.DITG_SERVER_TEMP_LOG + " &"
|
s = DITG.ITGRECV_BIN + " -l " + DITG.DITG_SERVER_TEMP_LOG + " &"
|
||||||
print(s)
|
print(s)
|
||||||
return s
|
return s
|
||||||
@ -81,11 +81,11 @@ class DITG(Experiment):
|
|||||||
super(DITG, self).clean()
|
super(DITG, self).clean()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
cmd = self.getServerCmd()
|
cmd = self.get_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")
|
||||||
cmd = self.getClientCmd()
|
cmd = self.get_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, "pkill -9 -f ITGRecv")
|
self.topo.command_to(self.topo_config.server, "pkill -9 -f ITGRecv")
|
||||||
self.topo.command_to(self.topo_config.server, DITG.ITGDEC_BIN + " " + DITG.DITG_SERVER_TEMP_LOG + " &> " + DITG.DITG_SERVER_LOG)
|
self.topo.command_to(self.topo_config.server, DITG.ITGDEC_BIN + " " + DITG.DITG_SERVER_TEMP_LOG + " &> " + DITG.DITG_SERVER_LOG)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
from core.experiment import Experiment, ExperimentParameter
|
from core.experiment import Experiment, ExperimentParameter
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class IPerfParameter(ExperimentParameter):
|
class IPerfParameter(ExperimentParameter):
|
||||||
TIME = "iperfTime"
|
TIME = "iperfTime"
|
||||||
PARALLEL = "iperfParallel"
|
PARALLEL = "iperfParallel"
|
||||||
@ -26,52 +28,34 @@ class IPerf(Experiment):
|
|||||||
self.load_parameters()
|
self.load_parameters()
|
||||||
self.ping()
|
self.ping()
|
||||||
|
|
||||||
def ping(self):
|
|
||||||
self.topo.command_to(self.topo_config.client, "rm " + \
|
|
||||||
IPerf.PING_OUTPUT)
|
|
||||||
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
|
|
||||||
for i in range(0, self.topo_config.client_interface_count()):
|
|
||||||
cmd = self.ping_command(self.topo_config.get_client_ip(i),
|
|
||||||
self.topo_config.get_server_ip(), n = count)
|
|
||||||
self.topo.command_to(self.topo_config.client, cmd)
|
|
||||||
|
|
||||||
def ping_command(self, fromIP, toIP, n=5):
|
|
||||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
|
||||||
" >> " + IPerf.PING_OUTPUT
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def load_parameters(self):
|
def load_parameters(self):
|
||||||
self.time = self.experiment_parameter.get(IPerfParameter.TIME)
|
self.time = self.experiment_parameter.get(IPerfParameter.TIME)
|
||||||
self.parallel = self.experiment_parameter.get(IPerfParameter.PARALLEL)
|
self.parallel = self.experiment_parameter.get(IPerfParameter.PARALLEL)
|
||||||
|
|
||||||
def prepare(self):
|
def prepare(self):
|
||||||
super(IPerf, self).prepare()
|
super(IPerf, self).prepare()
|
||||||
self.topo.command_to(self.topo_config.client, "rm " +
|
self.topo.command_to(self.topo_config.client, "rm {}".format(IPerf.IPERF_LOG))
|
||||||
IPerf.IPERF_LOG)
|
self.topo.command_to(self.topo_config.server, "rm {}".format(IPerf.SERVER_LOG))
|
||||||
self.topo.command_to(self.topo_config.server, "rm " +
|
|
||||||
IPerf.SERVER_LOG)
|
|
||||||
|
|
||||||
def getClientCmd(self):
|
def get_client_cmd(self):
|
||||||
s = IPerf.IPERF_BIN + " -c " + self.topo_config.get_server_ip() + \
|
s = "{} -c {} -t {} -P {} &>{}".format(IPerf.IPERF_BIN,
|
||||||
" -t " + self.time + " -P " + self.parallel + " &>" + IPerf.IPERF_LOG
|
self.topo_config.get_server_ip(), self.time, self.parallel, IPerf.IPERF_LOG)
|
||||||
print(s)
|
logging.info(s)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def getServerCmd(self):
|
def get_server_cmd(self):
|
||||||
s = "sudo " + IPerf.IPERF_BIN + " -s &>" + \
|
s = "{} -s &> {} &".format(IPerf.IPERF_BIN, IPerf.SERVER_LOG)
|
||||||
IPerf.SERVER_LOG + "&"
|
logging.info(s)
|
||||||
print(s)
|
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
super(IPerf, self).clean()
|
super(IPerf, self).clean()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
cmd = self.getServerCmd()
|
cmd = self.get_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")
|
||||||
cmd = self.getClientCmd()
|
cmd = self.get_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")
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from core.experiment import Experiment, ExperimentParameter
|
from core.experiment import Experiment, ExperimentParameter
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
@ -31,21 +32,6 @@ class Msg(Experiment):
|
|||||||
self.load_parameters()
|
self.load_parameters()
|
||||||
self.ping()
|
self.ping()
|
||||||
|
|
||||||
def ping(self):
|
|
||||||
self.topo.command_to(self.topo_config.client, "rm " + \
|
|
||||||
Msg.PING_OUTPUT )
|
|
||||||
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
|
|
||||||
for i in range(0, self.topo_config.client_interface_count()):
|
|
||||||
cmd = self.ping_command(self.topo_config.get_client_ip(i),
|
|
||||||
self.topo_config.get_server_ip(), n = count)
|
|
||||||
self.topo.command_to(self.topo_config.client, cmd)
|
|
||||||
|
|
||||||
def ping_command(self, fromIP, toIP, n=5):
|
|
||||||
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
|
||||||
" >> " + Msg.PING_OUTPUT
|
|
||||||
print(s)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def load_parameters(self):
|
def load_parameters(self):
|
||||||
self.client_sleep = self.experiment_parameter.get(MsgParameter.CLIENT_SLEEP)
|
self.client_sleep = self.experiment_parameter.get(MsgParameter.CLIENT_SLEEP)
|
||||||
self.server_sleep = self.experiment_parameter.get(MsgParameter.SERVER_SLEEP)
|
self.server_sleep = self.experiment_parameter.get(MsgParameter.SERVER_SLEEP)
|
||||||
@ -63,14 +49,14 @@ class Msg(Experiment):
|
|||||||
s = "python {}/../utils/msg_server.py --sleep {} --bytes {} &> {}&".format(
|
s = "python {}/../utils/msg_server.py --sleep {} --bytes {} &> {}&".format(
|
||||||
os.path.dirname(os.path.abspath(__file__)), self.server_sleep, self.bytes,
|
os.path.dirname(os.path.abspath(__file__)), self.server_sleep, self.bytes,
|
||||||
Msg.SERVER_LOG)
|
Msg.SERVER_LOG)
|
||||||
print(s)
|
logging.info(s)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def get_msg_client_cmd(self, daemon=False):
|
def get_msg_client_cmd(self, daemon=False):
|
||||||
s = "python {}/../utils/msg_client.py --sleep {} --nb {} --bytes {} > {} 2> {} {}".format(
|
s = "python {}/../utils/msg_client.py --sleep {} --nb {} --bytes {} > {} 2> {} {}".format(
|
||||||
os.path.dirname(os.path.abspath(__file__)), self.client_sleep, self.nb_requests,
|
os.path.dirname(os.path.abspath(__file__)), self.client_sleep, self.nb_requests,
|
||||||
self.bytes, Msg.CLIENT_LOG, Msg.CLIENT_ERR, "&" if daemon else "")
|
self.bytes, Msg.CLIENT_LOG, Msg.CLIENT_ERR, "&" if daemon else "")
|
||||||
print(s)
|
logging.info(s)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user