fully refactor experiment.py file

This commit is contained in:
Quentin De Coninck 2020-06-26 11:17:00 +02:00
parent 36fed8cc71
commit bdba7f3bf1
22 changed files with 292 additions and 233 deletions

View File

@ -1,9 +1,16 @@
from .parameter import Parameter from .parameter import Parameter
from topos.multi_interface import MultiInterfaceTopo
import logging
class ExperimentParameter(Parameter): class ExperimentParameter(Parameter):
""" """
Handler for experiment parameters stored in configuration files Handler for experiment parameters stored in configuration files.
The following parameters are common (and thus usable) by all experiments.
If you want to add experiement-specific parameters, you should extend this
class.
Attribute:
default_parameters Default values for the parameters
""" """
RMEM = "rmem" RMEM = "rmem"
WMEM = "wmem" WMEM = "wmem"
@ -20,18 +27,17 @@ class ExperimentParameter(Parameter):
USERPMS_ARGS = "upms_args" USERPMS_ARGS = "upms_args"
CLIENT_PCAP = "clientPcap" CLIENT_PCAP = "clientPcap"
SERVER_PCAP = "serverPcap" SERVER_PCAP = "serverPcap"
SNAPLEN_PCAP = "snaplenPcap" SNAPLEN_PCAP = "snaplen_pcap"
XP_TYPE = "xpType" XP_TYPE = "xpType"
PING_COUNT = "pingCount" PING_COUNT = "pingCount"
PRIO_PATH0 = "prioPath0" PRIO_PATH_0 = "priority_path_0"
PRIO_PATH1 = "prioPath1" PRIO_PATH_1 = "priority_path_1"
BACKUP_PATH0 = "backupPath0" BACKUP_PATH_0 = "backup_path_0"
BACKUP_PATH1 = "backupPath1" BACKUP_PATH_1 = "backup_path_1"
EXPIRATION = "expiration" EXPIRATION = "expiration"
BUFFER_AUTOTUNING = "bufferAutotuning" BUFFER_AUTOTUNING = "bufferAutotuning"
METRIC = "metric" METRIC = "metric"
# Global sysctl keys # Global sysctl keys
SYSCTL_KEY = { SYSCTL_KEY = {
RMEM: "net.ipv4.tcp_rmem", RMEM: "net.ipv4.tcp_rmem",
@ -76,10 +82,10 @@ class ExperimentParameter(Parameter):
SNAPLEN_PCAP: "65535", # Default snapping value of tcpdump SNAPLEN_PCAP: "65535", # Default snapping value of tcpdump
XP_TYPE: "none", XP_TYPE: "none",
PING_COUNT: "5", PING_COUNT: "5",
PRIO_PATH0: "0", PRIO_PATH_0: "0",
PRIO_PATH1: "0", PRIO_PATH_1: "0",
BACKUP_PATH0: "0", BACKUP_PATH_0: "0",
BACKUP_PATH1: "0", BACKUP_PATH_1: "0",
} }
def __init__(self, parameter_filename): def __init__(self, parameter_filename):
@ -87,6 +93,11 @@ class ExperimentParameter(Parameter):
self.default_parameters = ExperimentParameter.DEFAULT_PARAMETERS self.default_parameters = ExperimentParameter.DEFAULT_PARAMETERS
def get(self, key): def get(self, key):
"""
Get the value of the parameter with key `key`.
If not defined by the configuration file, return the default value.
Raise Exception if the parameter has no default value and is absent.
"""
val = super(ExperimentParameter, self).get(key) val = super(ExperimentParameter, self).get(key)
if val is None: if val is None:
if key in self.default_parameters: if key in self.default_parameters:
@ -117,6 +128,8 @@ class Experiment(object):
""" """
PARAMETER_CLASS = ExperimentParameter PARAMETER_CLASS = ExperimentParameter
IP_BIN = "ip"
def __init__(self, experiment_parameter_filename, topo, topo_config): def __init__(self, experiment_parameter_filename, topo, topo_config):
""" """
Instantiation of this base class only load the experiment parameter Instantiation of this base class only load the experiment parameter
@ -157,8 +170,8 @@ class Experiment(object):
self.change_metric() # TODO to move elsewhere self.change_metric() # TODO to move elsewhere
self.put_priority_on_paths() # TODO to move elsewhere self.put_priority_on_paths() # TODO to move elsewhere
self.disable_tso() self.disable_tso()
self.runTcpDump() self.run_tcpdump()
self.runNetemAt() self.run_netem_at()
def change_metric(self): def change_metric(self):
""" """
@ -173,235 +186,192 @@ class Experiment(object):
""" """
Function only meaningful for MPTCP Function only meaningful for MPTCP
""" """
# Only meaningful if mpTopo is instance of MultiInterfaceTopo priority_path_0 = self.experiment_parameter.get(ExperimentParameter.PRIO_PATH_0)
if isinstance(self.topo, MultiInterfaceTopo): priority_path_1 = self.experiment_parameter.get(ExperimentParameter.PRIO_PATH_1)
prioPath0 = self.experiment_parameter.get(ExperimentParameter.PRIO_PATH0) if not priority_path_0 == priority_path_1:
prioPath1 = self.experiment_parameter.get(ExperimentParameter.PRIO_PATH1) self.topo.command_to(self.topo_config.client, "{} link set dev {} priority {}".format(
if not prioPath0 == prioPath1: Experiment.IP_BIN, self.topo_config.get_client_interface(0), priority_path_0))
self.topo.command_to(self.topo_config.client, "/home/mininet/iproute/ip/ip link set dev " + self.topo.command_to(self.topo_config.router, "{} link set dev {} priority {}".format(
self.topo_config.getClientInterface(0) + " priority " + str(prioPath0)) Experiment.IP_BIN, self.topo_config.get_router_interface_to_switch(0), priority_path_0))
self.topo.command_to(self.topo_config.router, "/home/mininet/iproute/ip/ip link set dev " + self.topo.command_to(self.topo_config.client, "{} link set dev {} priority {}".format(
self.topo_config.getRouterInterfaceSwitch(0) + " priority " + Experiment.IP_BIN, self.topo_config.get_client_interface(1), priority_path_1))
str(prioPath0)) self.topo.command_to(self.topo_config.router, "{} link set dev {} priority {}".format(
self.topo.command_to(self.topo_config.client, "/home/mininet/iproute/ip/ip link set dev " + Experiment.IP_BIN, self.topo_config.get_router_interface_to_switch(1), priority_path_1))
self.topo_config.getClientInterface(1) + " priority " + str(prioPath1))
self.topo.command_to(self.topo_config.router, "/home/mininet/iproute/ip/ip link set dev " +
self.topo_config.getRouterInterfaceSwitch(1) + " priority " +
str(prioPath1))
backupPath0 = self.experiment_parameter.get(ExperimentParameter.BACKUP_PATH0) backup_path_0 = self.experiment_parameter.get(ExperimentParameter.BACKUP_PATH_0)
if int(backupPath0) > 0: if int(backup_path_0) > 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.client,
self.topo.command_to(self.topo_config.router, self.topo_config.interfaceBUPCommand(self.topo_config.getRouterInterfaceSwitch(0))) self.topo_config.interface_backup_command(self.topo_config.get_client_interface(0)))
backupPath1 = self.experiment_parameter.get(ExperimentParameter.BACKUP_PATH1) self.topo.command_to(self.topo_config.router,
if int(backupPath1) > 0: self.topo_config.interface_backup_command(self.topo_config.get_router_interface_to_switch(0)))
self.topo.command_to(self.topo_config.client, self.topo_config.interfaceBUPCommand(self.topo_config.getClientInterface(1))) backup_path_1 = self.experiment_parameter.get(ExperimentParameter.BACKUP_PATH_1)
self.topo.command_to(self.topo_config.router, self.topo_config.interfaceBUPCommand(self.topo_config.getRouterInterfaceSwitch(1))) if int(backup_path_1) > 0:
self.topo.command_to(self.topo_config.client,
self.topo_config.interface_backup_command(self.topo_config.get_client_interface(1)))
self.topo.command_to(self.topo_config.router,
self.topo_config.interface_backup_command(self.topo_config.get_router_interface_to_switch(1)))
def disable_tso(self): def disable_tso(self):
links = self.topo.getLinkCharacteristics() self.topo_config.disable_tso()
i = 0
for l in links:
lname = self.topo_config.getMidLeftName(i)
rname = self.topo_config.getMidRightName(i)
lbox = self.topo.get_host(lname)
lif = self.topo_config.getMidL2RInterface(i)
rif = self.topo_config.getMidR2LInterface(i)
rbox = self.topo.get_host(rname)
print(str(lname) + " " + str(lif))
print(str(rname) + " " + str(rif))
print("boxes " + str(lbox) + " " + str(rbox))
cmd = "ethtool -K " + lif + " tso off"
print(cmd)
self.topo.command_to(lbox, cmd)
cmd = "ethtool -K " + rif + " tso off"
print(cmd)
self.topo.command_to(rbox, cmd)
i = i + 1
# And for the server
cmd = "ethtool -K " + self.topo_config.getServerInterface() + " tso off"
print(cmd)
self.topo.command_to(self.topo_config.server, cmd)
cmd = "ethtool -K " + self.topo_config.getRouterInterfaceSwitch(self.topo_config.getClientInterfaceCount()) + " tso off"
print(cmd)
self.topo.command_to(self.topo_config.router, cmd)
def run_userspace_path_manager(self): def run_userspace_path_manager(self):
"""
Function only meaningful to MPTCP with a specific path manager
"""
if self.experiment_parameter.get(ExperimentParameter.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 !") logging.warning("Client: unable to change the userspace pm if the kernel pm is not netlink")
else: else:
upmc = self.experiment_parameter.get(ExperimentParameter.USERPMC) upmc = self.experiment_parameter.get(ExperimentParameter.USERPMC)
upmca = self.experiment_parameter.get(ExperimentParameter.USERPMC_ARGS) upmca = self.experiment_parameter.get(ExperimentParameter.USERPMC_ARGS)
self.topo.command_to(self.topo_config.client, upmc + \ self.topo.command_to(self.topo_config.client, "{} {} &>{} &".format(
" " + upmca + " &>upmc.log &") upmc, upmca, "upmc.log"))
if self.experiment_parameter.get(ExperimentParameter.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 !") logging.warning("Server: unable to change the userspace pm if the kernel pm is not netlink")
else: else:
upms = self.experiment_parameter.get(ExperimentParameter.USERPMS) upms = self.experiment_parameter.get(ExperimentParameter.USERPMS)
upmsa = self.experiment_parameter.get(ExperimentParameter.USERPMS_ARGS) upmsa = self.experiment_parameter.get(ExperimentParameter.USERPMS_ARGS)
self.topo.command_to(self.topo_config.server, upms + \ self.topo.command_to(self.topo_config.server, "{} {} &>{} &".format(
" " + upmsa + " &>upms.log &") upms, upmsa, "upms.log"))
def cleanUserspacePM(self): def clean_userspace_path_manager(self):
if self.experiment_parameter.get(ExperimentParameter.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 !") logging.warning("Client: unable to change the userspace pm if the kernel pm is not netlink")
else: else:
upmc = self.experiment_parameter.get(ExperimentParameter.USERPMC) upmc = self.experiment_parameter.get(ExperimentParameter.USERPMC)
self.topo.command_to(self.topo_config.client, "killall " + upmc) self.topo.command_to(self.topo_config.client, "killall {}".format(upmc))
if self.experiment_parameter.get(ExperimentParameter.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 !") logging.warning("Server: unable to change the userspace pm if the kernel pm is not netlink")
else: else:
upms = self.experiment_parameter.get(ExperimentParameter.USERPMS) upms = self.experiment_parameter.get(ExperimentParameter.USERPMS)
self.topo.command_to(self.topo_config.server, "killall " + upms) self.topo.command_to(self.topo_config.client, "killall {}".format(upms))
def runNetemAt(self): def run_netem_at(self):
if not self.topo.changeNetem == "yes": self.topo_config.run_netem_at()
print("I don't need to change netem")
return
print("Will change netem config on the fly")
links = self.topo.getLinkCharacteristics()
i = 0
for l in links:
lname = self.topo_config.getMidLeftName(i)
rname = self.topo_config.getMidRightName(i)
lbox = self.topo.get_host(lname)
lif = self.topo_config.getMidL2RInterface(i)
rif = self.topo_config.getMidR2LInterface(i)
rbox = self.topo.get_host(rname)
print(str(lname) + " " + str(lif))
print(str(rname) + " " + str(rif))
print("boxes " + str(lbox) + " " + str(rbox))
cmd = l.buildBwCmd(lif)
print(cmd)
self.topo.command_to(lbox, cmd)
cmd = l.buildBwCmd(rif)
print(cmd)
self.topo.command_to(rbox, cmd)
ilif = self.topo_config.getMidL2RIncomingInterface(i)
irif = self.topo_config.getMidR2LIncomingInterface(i)
cmd = l.buildPolicingCmd(ilif)
print(cmd)
self.topo.command_to(lbox, cmd)
cmd = l.buildPolicingCmd(irif)
print(cmd)
self.topo.command_to(rbox, cmd)
cmd = l.buildNetemCmd(irif)
print(cmd)
self.topo.command_to(rbox, cmd)
cmd = l.buildNetemCmd(ilif)
print(cmd)
self.topo.command_to(lbox, cmd)
i = i + 1
def run(self): def run(self):
pass """
Perform the experiment
This function MUST be overriden by child classes
"""
raise NotImplementedError("Trying to run Experiment")
def clean(self): def clean(self):
self.topo.command_to(self.topo_config.client, """
"killall tcpdump") Clean the environment where the experiment took place.
self.topo.command_to(self.topo_config.server, Typically, when you inherit from this class, you want to extend this
"killall tcpdump") method, while still calling this parent function.
self.backUpSysctl() """
self.cleanUserspacePM() self.topo.command_to(self.topo_config.client, "killall tcpdump")
pass self.topo.command_to(self.topo_config.server, "killall tcpdump")
self.restore_sysctl()
self.clean_userspace_path_manager()
def setup_sysctl(self): def setup_sysctl(self):
"""
Record the current sysctls of the host and write the experiment ones
"""
self.save_sysctl() self.save_sysctl()
self.write_sysctl() self.write_sysctl()
def save_sysctl(self): def save_sysctl(self):
self.sysctlBUP = {} """
self._save_sysctl(ExperimentParameter.SYSCTL_KEY, self.sysctlBUP) Record the current sysctls
self.sysctlBUPC = {} """
self._save_sysctl(ExperimentParameter.SYSCTL_KEY_CLIENT, self.sysctlBUPC, self.sysctl_to_restore = {}
self._save_sysctl(ExperimentParameter.SYSCTL_KEY, self.sysctl_to_restore)
self.client_sysctl_to_restore = {}
self._save_sysctl(ExperimentParameter.SYSCTL_KEY_CLIENT, self.client_sysctl_to_restore,
ns=True, who=self.topo_config.client) ns=True, who=self.topo_config.client)
self.sysctlBUPS = {} self.server_sysctl_to_restore = {}
self._save_sysctl(ExperimentParameter.SYSCTL_KEY_SERVER, self.sysctlBUPS, self._save_sysctl(ExperimentParameter.SYSCTL_KEY_SERVER, self.server_sysctl_to_restore,
ns=True, who=self.topo_config.server) ns=True, who=self.topo_config.server)
def _save_sysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): def _save_sysctl(self, sysctl_dict, sysctl_to_restore, ns=False, who=None):
for k in sysctlDic: for k in sysctl_dict:
SYSCTL_KEY = sysctlDic[k] sysctl_key = sysctl_dict[k]
cmd = self.cmdReadSysctl(SYSCTL_KEY) cmd = self.read_sysctl_cmd(sysctl_key)
if not ns: if not ns:
val = self.topo.command_global(cmd) val = self.topo.command_global(cmd)
else: else:
val = self.topo.command_to(who, cmd) val = self.topo.command_to(who, cmd)
if val == "Error": if val == "Error":
print("oooops can't get sysctl " + SYSCTL_KEY) logging.error("unable to get sysctl {}".format(sysctl_key))
else: else:
# For Python3 compatibility # For Python3 compatibility
if type(val) is bytes: if type(val) is bytes:
val = val.decode() val = val.decode()
sysctlBUP[k] = val.split(" ",2)[2][:-1] sysctl_to_restore[k] = val.split(" ", 2)[2][:-1]
def read_sysctl_cmd(self, key):
def cmdReadSysctl(self, key): """
s = "sysctl " + key Return a bash command to read the sysctl key `key`
return s """
return "sysctl {}".format(key)
def cmd_write_sysctl(self, key, value): def cmd_write_sysctl(self, key, value):
s = self.cmdReadSysctl(key) """
s = s + "=\"" + str(value) + "\"" Return a bash command to write the sysctl key `key`with value `value`
return s """
return '{}="{}"'.format(self.read_sysctl_cmd(key), value)
def write_sysctl(self): def write_sysctl(self):
self._write_sysctl(ExperimentParameter.SYSCTL_KEY, self.sysctlBUP) """
self._write_sysctl(ExperimentParameter.SYSCTL_KEY_CLIENT, self.sysctlBUPC, Write the experiment sysctls
"""
self._write_sysctl(ExperimentParameter.SYSCTL_KEY, self.sysctl_to_restore)
self._write_sysctl(ExperimentParameter.SYSCTL_KEY_CLIENT, self.client_sysctl_to_restore,
ns=True, who=self.topo_config.client) ns=True, who=self.topo_config.client)
self._write_sysctl(ExperimentParameter.SYSCTL_KEY_SERVER, self.sysctlBUPS, self._write_sysctl(ExperimentParameter.SYSCTL_KEY_SERVER, self.server_sysctl_to_restore,
ns=True, who=self.topo_config.server) ns=True, who=self.topo_config.server)
def _write_sysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): def _write_sysctl(self, sysctl_dict, sysctl_to_restore, ns = False, who = None):
for k in sysctlBUP: for k in sysctl_to_restore:
SYSCTL_KEY = sysctlDic[k] sysctl_key = sysctl_dict[k]
sysctlValue = self.experiment_parameter.get(k) sysctl_value = self.experiment_parameter.get(k)
cmd = self.cmd_write_sysctl(SYSCTL_KEY,sysctlValue) cmd = self.cmd_write_sysctl(sysctl_key, sysctl_value)
if not ns: if not ns:
val = self.topo.command_global(cmd) val = self.topo.command_global(cmd)
else: else:
val = self.topo.command_to(who, cmd) val = self.topo.command_to(who, cmd)
if val == "Error": if val == "Error":
print("oooops can't set sysctl " + SYSCTL_KEY) logging.error("unable to set sysctl {}".format(sysctl_key))
def restore_sysctl(self):
def backUpSysctl(self): """
self._backUpSysctl(ExperimentParameter.SYSCTL_KEY, self.sysctlBUP) Restore back the sysctls that were present before running the experiment
self._backUpSysctl(ExperimentParameter.SYSCTL_KEY_CLIENT, self.sysctlBUPC, """
self._restore_sysctl(ExperimentParameter.SYSCTL_KEY, self.sysctl_to_restore)
self._restore_sysctl(ExperimentParameter.SYSCTL_KEY_CLIENT, self.client_sysctl_to_restore,
ns=True, who=self.topo_config.client) ns=True, who=self.topo_config.client)
self._backUpSysctl(ExperimentParameter.SYSCTL_KEY_SERVER, self.sysctlBUPS, self._restore_sysctl(ExperimentParameter.SYSCTL_KEY_SERVER, self.server_sysctl_to_restore,
ns=True, who=self.topo_config.server) ns=True, who=self.topo_config.server)
def _restore_sysctl(self, sysctl_dict, sysctl_to_restore, ns = False, who = None):
def _backUpSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): for k in sysctl_to_restore:
for k in sysctlBUP: sysctl_key = sysctl_dict[k]
SYSCTL_KEY = sysctlDic[k] sysctl_value = sysctl_to_restore[k]
sysctlValue = sysctlBUP[k] cmd = self.cmd_write_sysctl(sysctl_key, sysctl_value)
cmd = self.cmd_write_sysctl(SYSCTL_KEY,sysctlValue)
if not ns: if not ns:
val = self.topo.command_global(cmd) val = self.topo.command_global(cmd)
else: else:
val = self.topo.command_to(who, cmd) val = self.topo.command_to(who, cmd)
if val == "Error": if val == "Error":
print("oooops can't set sysctl " + SYSCTL_KEY) logging.error("unable to set sysctl {}".format(sysctl_key))
def run_tcpdump(self):
def runTcpDump(self): client_pcap = self.experiment_parameter.get(ExperimentParameter.CLIENT_PCAP)
#todo : replace filename by cst server_pcap = self.experiment_parameter.get(ExperimentParameter.SERVER_PCAP)
cpcap = self.experiment_parameter.get(ExperimentParameter.CLIENT_PCAP) snaplen_pcap = self.experiment_parameter.get(ExperimentParameter.SNAPLEN_PCAP)
spcap = self.experiment_parameter.get(ExperimentParameter.SERVER_PCAP) if client_pcap == "yes":
snaplenpcap = self.experiment_parameter.get(ExperimentParameter.SNAPLEN_PCAP)
if cpcap == "yes" :
self.topo.command_to(self.topo_config.client, self.topo.command_to(self.topo_config.client,
"tcpdump -i any -s " + snaplenpcap + " -w client.pcap &") "tcpdump -i any -s {} -w client.pcap &".format(snaplen_pcap))
if spcap == "yes" : if server_pcap == "yes":
self.topo.command_to(self.topo_config.server, self.topo.command_to(self.topo_config.server,
"tcpdump -i any -s " + snaplenpcap + " -w server.pcap &") "tcpdump -i any -s {} -w server.pcap &".format(snaplen_pcap))
if spcap == "yes" or cpcap == "yes": if server_pcap == "yes" or client_pcap == "yes":
logging.info("Activating tcpdump, waiting for it to run")
self.topo.command_to(self.topo_config.client,"sleep 5") self.topo.command_to(self.topo_config.client,"sleep 5")

View File

@ -1,5 +1,6 @@
from .parameter import Parameter from .parameter import Parameter
import logging
import math import math
@ -281,6 +282,79 @@ class TopoConfig(object):
self.configureInterfaces() self.configureInterfaces()
self.configureRoute() self.configureRoute()
def disable_tso(self):
"""
Disable TSO on all interfaces
"""
links = self.topo.getLinkCharacteristics()
for i, l in enumerate(links):
lname = self.getMidLeftName(i)
rname = self.getMidRightName(i)
lbox = self.topo.get_host(lname)
lif = self.getMidL2RInterface(i)
rif = self.getMidR2LInterface(i)
rbox = self.topo.get_host(rname)
print(str(lname) + " " + str(lif))
print(str(rname) + " " + str(rif))
print("boxes " + str(lbox) + " " + str(rbox))
cmd = "ethtool -K " + lif + " tso off"
print(cmd)
self.topo.command_to(lbox, cmd)
cmd = "ethtool -K " + rif + " tso off"
print(cmd)
self.topo.command_to(rbox, cmd)
# And for the server
cmd = "ethtool -K " + self.getServerInterface() + " tso off"
print(cmd)
self.topo.command_to(self.server, cmd)
cmd = "ethtool -K " + self.get_router_interface_to_switch(self.client_interface_count()) + " tso off"
print(cmd)
self.topo.command_to(self.router, cmd)
def run_netem_at(self):
"""
Prepare netem commands to be run after some delay
"""
if not self.topo.changeNetem == "yes":
# Just rely on defaults of TCLink
logging.debug("No need to change netem")
return
logging.info("Will change netem config on the fly")
links = self.topo.getLinkCharacteristics()
for i, l in enumerate(links):
lname = self.getMidLeftName(i)
rname = self.getMidRightName(i)
lbox = self.topo.get_host(lname)
lif = self.getMidL2RInterface(i)
rif = self.getMidR2LInterface(i)
rbox = self.topo.get_host(rname)
print(str(lname) + " " + str(lif))
print(str(rname) + " " + str(rif))
print("boxes " + str(lbox) + " " + str(rbox))
cmd = l.buildBwCmd(lif)
print(cmd)
self.topo.command_to(lbox, cmd)
cmd = l.buildBwCmd(rif)
print(cmd)
self.topo.command_to(rbox, cmd)
ilif = self.getMidL2RIncomingInterface(i)
irif = self.getMidR2LIncomingInterface(i)
cmd = l.buildPolicingCmd(ilif)
print(cmd)
self.topo.command_to(lbox, cmd)
cmd = l.buildPolicingCmd(irif)
print(cmd)
self.topo.command_to(rbox, cmd)
cmd = l.buildNetemCmd(irif)
print(cmd)
self.topo.command_to(rbox, cmd)
cmd = l.buildNetemCmd(ilif)
print(cmd)
self.topo.command_to(lbox, cmd)
def getMidL2RInterface(self, id): def getMidL2RInterface(self, id):
"get Middle link, left to right interface" "get Middle link, left to right interface"
pass pass
@ -298,10 +372,25 @@ class TopoConfig(object):
def configureInterfaces(self): def configureInterfaces(self):
pass pass
def getClientInterfaceCount(self): def client_interface_count(self):
raise Exception("To be implemented") """
Return the number of client's interfaces
"""
raise NotImplementedError()
def interfaceBUPCommand(self, interfaceName): def get_client_interface(self, index):
"""
Return the client's interface with index `index`
"""
raise NotImplementedError()
def get_router_interface_to_switch(self, index):
"""
Return the router's interface to switch with index `index`
"""
raise NotImplementedError()
def interface_backup_command(self, interfaceName):
s = "/home/mininet/git/iproute-mptcp/ip/ip link set dev " + interfaceName + " multipath backup " s = "/home/mininet/git/iproute-mptcp/ip/ip link set dev " + interfaceName + " multipath backup "
print(s) print(s)
return s return s

View File

@ -30,7 +30,7 @@ class AB(RandomFileExperiment):
self.topo.command_to(self.topo_config.client, self.topo.command_to(self.topo_config.client,
"rm " + AB.PING_OUTPUT) "rm " + AB.PING_OUTPUT)
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -45,7 +45,7 @@ class DITG(Experiment):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
Experiment.PING_OUTPUT) Experiment.PING_OUTPUT)
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -30,7 +30,7 @@ class Epload(Experiment):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
Epload.PING_OUTPUT ) Epload.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -17,7 +17,7 @@ class HTTP(RandomFileExperiment):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
HTTP.PING_OUTPUT ) HTTP.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -17,7 +17,7 @@ class HTTPS(RandomFileExperiment):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
HTTPS.PING_OUTPUT ) HTTPS.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -30,7 +30,7 @@ class IPerf(Experiment):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
IPerf.PING_OUTPUT) IPerf.PING_OUTPUT)
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -35,7 +35,7 @@ class Msg(Experiment):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
Msg.PING_OUTPUT ) Msg.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -51,7 +51,7 @@ class NCPV(NC):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
NCPV.PING_OUTPUT ) NCPV.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -35,7 +35,7 @@ class Netperf(Experiment):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
Netperf.PING_OUTPUT) Netperf.PING_OUTPUT)
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -18,7 +18,7 @@ class Ping(Experiment):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
Ping.PING_OUTPUT ) Ping.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -34,7 +34,7 @@ class QUIC(RandomFileExperiment):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
QUIC.PING_OUTPUT ) QUIC.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -33,7 +33,7 @@ class QUICSiri(Experiment):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
QUICSiri.PING_OUTPUT ) QUICSiri.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -17,7 +17,7 @@ class SendFile(RandomFileExperiment):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
SendFile.PING_OUTPUT ) SendFile.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -48,7 +48,7 @@ class Siri(Experiment):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
Siri.PING_OUTPUT ) Siri.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -22,7 +22,7 @@ class SiriHTTP(Siri, RandomFileExperiment):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
SiriHTTP.PING_OUTPUT ) SiriHTTP.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -30,7 +30,7 @@ class VLC(Experiment):
self.topo.command_to(self.topo_config.client, "rm " + \ self.topo.command_to(self.topo_config.client, "rm " + \
VLC.PING_OUTPUT ) VLC.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT) count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.getClientInterfaceCount()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i), cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count) self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)

View File

@ -150,7 +150,7 @@ class ECMPSingleInterfaceConfig(TopoConfig):
i = i + 1 i = i + 1
cmd = self.interfaceUpCommand(self.getClientInterface(0), cmd = self.interfaceUpCommand(self.get_client_interface(0),
self.getClientIP(0), netmask) self.getClientIP(0), netmask)
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
@ -183,7 +183,7 @@ class ECMPSingleInterfaceConfig(TopoConfig):
serverIP = rSubnet + "0.1" serverIP = rSubnet + "0.1"
return serverIP return serverIP
def getClientInterfaceCount(self): def client_interface_count(self):
return 1 return 1
def getRouterInterfaceLSwitch(self, id): def getRouterInterfaceLSwitch(self, id):
@ -192,7 +192,7 @@ class ECMPSingleInterfaceConfig(TopoConfig):
def getRouterInterfaceRSwitch(self, id): def getRouterInterfaceRSwitch(self, id):
return Topo.routerNamePrefix + str(id) + "-eth1" return Topo.routerNamePrefix + str(id) + "-eth1"
def getClientInterface(self, interfaceID): def get_client_interface(self, interfaceID):
return Topo.clientName + "-eth" + str(interfaceID) return Topo.clientName + "-eth" + str(interfaceID)
def getServerInterface(self): def getServerInterface(self):

View File

@ -58,7 +58,7 @@ class MultiInterfaceConfig(TopoConfig):
cmd = self.addRouteScopeLinkCommand( cmd = self.addRouteScopeLinkCommand(
self.getClientSubnet(i), self.getClientSubnet(i),
self.getClientInterface(i), i) self.get_client_interface(i), i)
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
cmd = self.addRouteDefaultCommand(self.getRouterIPSwitch(i), cmd = self.addRouteDefaultCommand(self.getRouterIPSwitch(i),
@ -67,7 +67,7 @@ class MultiInterfaceConfig(TopoConfig):
i = i + 1 i = i + 1
cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0), cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0),
self.getClientInterface(0)) self.get_client_interface(0))
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
cmd = self.addRouteDefaultSimple(self.getRouterIPServer()) cmd = self.addRouteDefaultSimple(self.getRouterIPServer())
@ -84,15 +84,15 @@ class MultiInterfaceConfig(TopoConfig):
links = self.topo.getLinkCharacteristics() links = self.topo.getLinkCharacteristics()
for l in self.topo.switchClient: for l in self.topo.switchClient:
cmd = self.interfaceUpCommand( cmd = self.interfaceUpCommand(
self.getClientInterface(i), self.get_client_interface(i),
self.getClientIP(i), netmask) self.getClientIP(i), netmask)
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
clientIntfMac = self.client.intf(self.getClientInterface(i)).MAC() clientIntfMac = self.client.intf(self.get_client_interface(i)).MAC()
self.topo.command_to(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac) self.topo.command_to(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac)
if(links[i].back_up): if(links[i].back_up):
cmd = self.interfaceBUPCommand( cmd = self.interface_backup_command(
self.getClientInterface(i)) self.get_client_interface(i))
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
i = i + 1 i = i + 1
@ -100,10 +100,10 @@ class MultiInterfaceConfig(TopoConfig):
i = 0 i = 0
for l in self.topo.switchServer: for l in self.topo.switchServer:
cmd = self.interfaceUpCommand( cmd = self.interfaceUpCommand(
self.getRouterInterfaceSwitch(i), self.get_router_interface_to_switch(i),
self.getRouterIPSwitch(i), netmask) self.getRouterIPSwitch(i), netmask)
self.topo.command_to(self.router, cmd) self.topo.command_to(self.router, cmd)
routerIntfMac = self.router.intf(self.getRouterInterfaceSwitch(i)).MAC() routerIntfMac = self.router.intf(self.get_router_interface_to_switch(i)).MAC()
self.topo.command_to(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) self.topo.command_to(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac)
print(str(links[i])) print(str(links[i]))
i = i + 1 i = i + 1
@ -145,16 +145,16 @@ class MultiInterfaceConfig(TopoConfig):
serverIP = rSubnet + "0.1" serverIP = rSubnet + "0.1"
return serverIP return serverIP
def getClientInterfaceCount(self): def client_interface_count(self):
return len(self.topo.switchClient) return len(self.topo.switchClient)
def getRouterInterfaceServer(self): def getRouterInterfaceServer(self):
return self.getRouterInterfaceSwitch(len(self.topo.switchServer)) return self.get_router_interface_to_switch(len(self.topo.switchServer))
def getClientInterface(self, interfaceID): def get_client_interface(self, interfaceID):
return Topo.clientName + "-eth" + str(interfaceID) return Topo.clientName + "-eth" + str(interfaceID)
def getRouterInterfaceSwitch(self, interfaceID): def get_router_interface_to_switch(self, interfaceID):
return Topo.routerName + "-eth" + str(interfaceID) return Topo.routerName + "-eth" + str(interfaceID)
def getServerInterface(self): def getServerInterface(self):

View File

@ -73,7 +73,7 @@ class MultiInterfaceCongConfig(TopoConfig):
cmd = self.addRouteScopeLinkCommand( cmd = self.addRouteScopeLinkCommand(
self.getClientSubnet(i), self.getClientSubnet(i),
self.getClientInterface(i), i) self.get_client_interface(i), i)
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
# Congestion client # Congestion client
@ -96,7 +96,7 @@ class MultiInterfaceCongConfig(TopoConfig):
i = i + 1 i = i + 1
cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0), cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0),
self.getClientInterface(0)) self.get_client_interface(0))
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
# Congestion Client # Congestion Client
@ -137,15 +137,15 @@ class MultiInterfaceCongConfig(TopoConfig):
links = self.topo.getLinkCharacteristics() links = self.topo.getLinkCharacteristics()
for l in self.topo.switch: for l in self.topo.switch:
cmd = self.interfaceUpCommand( cmd = self.interfaceUpCommand(
self.getClientInterface(i), self.get_client_interface(i),
self.getClientIP(i), netmask) self.getClientIP(i), netmask)
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
clientIntfMac = self.client.intf(self.getClientInterface(i)).MAC() clientIntfMac = self.client.intf(self.get_client_interface(i)).MAC()
self.topo.command_to(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac) self.topo.command_to(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac)
if(links[i].back_up): if(links[i].back_up):
cmd = self.interfaceBUPCommand( cmd = self.interface_backup_command(
self.getClientInterface(i)) self.get_client_interface(i))
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
# Congestion client # Congestion client
@ -157,10 +157,10 @@ class MultiInterfaceCongConfig(TopoConfig):
self.topo.command_to(self.router, "arp -s " + self.getCongClientIP(i) + " " + congClientIntfMac) self.topo.command_to(self.router, "arp -s " + self.getCongClientIP(i) + " " + congClientIntfMac)
cmd = self.interfaceUpCommand( cmd = self.interfaceUpCommand(
self.getRouterInterfaceSwitch(i), self.get_router_interface_to_switch(i),
self.getRouterIPSwitch(i), netmask) self.getRouterIPSwitch(i), netmask)
self.topo.command_to(self.router, cmd) self.topo.command_to(self.router, cmd)
routerIntfMac = self.router.intf(self.getRouterInterfaceSwitch(i)).MAC() routerIntfMac = self.router.intf(self.get_router_interface_to_switch(i)).MAC()
self.topo.command_to(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) self.topo.command_to(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac)
# Don't forget the congestion client # Don't forget the congestion client
self.topo.command_to(self.cong_clients[i], "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) self.topo.command_to(self.cong_clients[i], "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac)
@ -235,22 +235,22 @@ class MultiInterfaceCongConfig(TopoConfig):
serverIP = rSubnet + str(1 + congID) + ".1" serverIP = rSubnet + str(1 + congID) + ".1"
return serverIP return serverIP
def getClientInterfaceCount(self): def client_interface_count(self):
return len(self.topo.switch) return len(self.topo.switch)
def getRouterInterfaceServer(self): def getRouterInterfaceServer(self):
return self.getRouterInterfaceSwitch(len(self.topo.switch)) return self.get_router_interface_to_switch(len(self.topo.switch))
def getRouterInterfaceCongServer(self, congID): def getRouterInterfaceCongServer(self, congID):
return self.getRouterInterfaceSwitch(len(self.topo.switch) + 1 + congID) return self.get_router_interface_to_switch(len(self.topo.switch) + 1 + congID)
def getClientInterface(self, interfaceID): def get_client_interface(self, interfaceID):
return Topo.clientName + "-eth" + str(interfaceID) return Topo.clientName + "-eth" + str(interfaceID)
def getCongClientInterface(self, interfaceID): def getCongClientInterface(self, interfaceID):
return MultiInterfaceCongConfig.congClientName + str(interfaceID) + "-eth0" return MultiInterfaceCongConfig.congClientName + str(interfaceID) + "-eth0"
def getRouterInterfaceSwitch(self, interfaceID): def get_router_interface_to_switch(self, interfaceID):
return Topo.routerName + "-eth" + str(interfaceID) return Topo.routerName + "-eth" + str(interfaceID)
def getServerInterface(self): def getServerInterface(self):

View File

@ -151,7 +151,7 @@ class TwoInterfaceCongestionConfig(TopoConfig):
self.configureInterface(self.client, self.router, Topo.clientName + "-eth0", "10.0.0.1", netmask) self.configureInterface(self.client, self.router, Topo.clientName + "-eth0", "10.0.0.1", netmask)
if(links[0].back_up): if(links[0].back_up):
cmd = self.interfaceBUPCommand(Topo.clientName + "-eth0") cmd = self.interface_backup_command(Topo.clientName + "-eth0")
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
self.configureInterface(self.router, self.client, Topo.routerName + "-eth0", "10.0.0.2", netmask) self.configureInterface(self.router, self.client, Topo.routerName + "-eth0", "10.0.0.2", netmask)
@ -161,7 +161,7 @@ class TwoInterfaceCongestionConfig(TopoConfig):
self.configureInterface(self.client, self.routerCong, Topo.clientName + "-eth1", "10.0.1.1", netmask) self.configureInterface(self.client, self.routerCong, Topo.clientName + "-eth1", "10.0.1.1", netmask)
if(links[1].back_up): if(links[1].back_up):
cmd = self.interfaceBUPCommand(Topo.clientName + "-eth1") cmd = self.interface_backup_command(Topo.clientName + "-eth1")
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
self.configureInterface(self.routerCong, self.client, Topo.routerName + "Cong-eth0", "10.0.1.2", netmask) self.configureInterface(self.routerCong, self.client, Topo.routerName + "Cong-eth0", "10.0.1.2", netmask)
@ -219,16 +219,16 @@ class TwoInterfaceCongestionConfig(TopoConfig):
serverIP = rSubnet + "0.1" serverIP = rSubnet + "0.1"
return serverIP return serverIP
def getClientInterfaceCount(self): def client_interface_count(self):
return len(self.topo.switch) return len(self.topo.switch)
def getRouterInterfaceServer(self): def getRouterInterfaceServer(self):
return self.getRouterInterfaceSwitch(len(self.topo.switch)) return self.get_router_interface_to_switch(len(self.topo.switch))
def getClientInterface(self, interfaceID): def get_client_interface(self, interfaceID):
return Topo.clientName + "-eth" + str(interfaceID) return Topo.clientName + "-eth" + str(interfaceID)
def getRouterInterfaceSwitch(self, interfaceID): def get_router_interface_to_switch(self, interfaceID):
return Topo.routerName + "-eth" + str(interfaceID) return Topo.routerName + "-eth" + str(interfaceID)
def getServerInterface(self): def getServerInterface(self):