refactoring of Topo

This commit is contained in:
Quentin De Coninck 2020-06-29 09:51:55 +02:00
parent 894579b91c
commit af06305029
24 changed files with 406 additions and 493 deletions

View File

@ -90,22 +90,7 @@ class ExperimentParameter(Parameter):
def __init__(self, parameter_filename):
super(ExperimentParameter, self).__init__(parameter_filename)
self.default_parameters = ExperimentParameter.DEFAULT_PARAMETERS
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)
if val is None:
if key in self.default_parameters:
return self.default_parameters[key]
else:
raise Exception("Parameter not found " + key)
else:
return val
self.default_parameters.update(ExperimentParameter.DEFAULT_PARAMETERS)
class Experiment(object):
@ -129,6 +114,7 @@ class Experiment(object):
PARAMETER_CLASS = ExperimentParameter
IP_BIN = "ip"
PING_OUTPUT = "ping.log"
def __init__(self, experiment_parameter_filename, topo, topo_config):
"""
@ -374,6 +360,18 @@ class Experiment(object):
logging.info("Activating tcpdump, waiting for it to run")
self.topo.command_to(self.topo_config.client,"sleep 5")
def ping(self):
self.topo.command_to(self.topo_config.client,
"rm {}".format(Experiment.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.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def ping_command(self, from_ip, to_ip, n=5):
return "ping -c {} -I {} {} >> {}".format(n, from_ip, to_ip, Experiment.PING_OUTPUT)
class RandomFileParameter(ExperimentParameter):
"""

View File

@ -6,9 +6,11 @@ class Parameter(object):
Attributes:
parameters dictionary containing the value for configuration parameters
default_parameters dictionary containung default values for parameters
"""
def __init__(self, parameter_filename):
self.parameters = {}
self.default_parameters = {}
if parameter_filename is None:
logging.warning("No parameter file provided; using default parameters")
else:
@ -37,9 +39,18 @@ class Parameter(object):
def get(self, key):
"""
Get the parameter with key `key`. If it does not exist, return None
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.
"""
return self.parameters.get(key)
val = self.parameters.get(key)
if val is None:
if key in self.default_parameters:
return self.default_parameters[key]
else:
raise Exception("Parameter not found " + key)
else:
return val
def __str__(self):
return self.parameters.__str__()

View File

@ -5,6 +5,9 @@ import math
class NetemAt(object):
"""
Class representing a netem command to be run after some time
"""
def __init__(self, at, cmd):
self.at = at
self.cmd = cmd
@ -110,89 +113,85 @@ Link id: {}
class TopoParameter(Parameter):
LSUBNET = "leftSubnet"
RSUBNET = "rightSubnet"
netem_at = "netem_at_"
changeNetem = "changeNetem"
DEFAULT_PARAMETERS = {}
DEFAULT_PARAMETERS[LSUBNET] = "10.1."
DEFAULT_PARAMETERS[RSUBNET] = "10.2."
DEFAULT_PARAMETERS[changeNetem] = "false"
LEFT_SUBNET = "leftSubnet"
RIGHT_SUBNET = "rightSubnet"
NETEM_AT = "netem_at_"
CHANGE_NETEM = "changeNetem"
DEFAULT_PARAMETERS = {
LEFT_SUBNET: "10.1.",
RIGHT_SUBNET: "10.2.",
CHANGE_NETEM: "false",
}
def __init__(self, parameter_filename):
Parameter.__init__(self, parameter_filename)
self.linkCharacteristics = []
self.loadLinkCharacteristics()
self.loadNetemAt()
print(self.__str__())
self.default_parameters.update(TopoParameter.DEFAULT_PARAMETERS)
self.link_characteristics = []
self.load_link_characteristics()
self.load_netem_at()
logging.info(self)
def loadNetemAt(self):
if not self.get(TopoParameter.changeNetem) == "yes":
def load_netem_at(self):
if not self.get(TopoParameter.CHANGE_NETEM) == "yes":
return
for k in sorted(self.parameters):
if k.startswith(TopoParameter.netem_at):
i = int(k[len(TopoParameter.netem_at):])
if k.startswith(TopoParameter.NETEM_AT):
link_id = int(k[len(TopoParameter.NETEM_AT):])
val = self.parameters[k]
if not isinstance(val, list):
tmp = val
val = []
val.append(tmp)
self.loadNetemAtList(i, val)
self.load_netem_at_list(link_id, val)
def loadNetemAtList(self, id, nlist):
def load_netem_at_list(self, link_id, nlist):
for n in nlist:
tab = n.split(",")
if len(tab)==2:
o = NetemAt(float(tab[0]), tab[1])
if id < len(self.linkCharacteristics):
self.linkCharacteristics[id].add_netem_at(o)
try:
at, cmd = n.split(",")
na = NetemAt(float(at), cmd)
if link_id < len(self.link_characteristics):
self.link_characteristics[id].add_netem_at(na)
else:
print("Error can't set netem for link " + str(id))
else:
print("Netem wrong line : " + n)
print(self.linkCharacteristics[id].netem_at)
logging.error("Unable to set netem for link {}; only have {} links".format(
link_id, len(self.link_characteristics)))
except ValueError as e:
logging.error("Unable to set netem for link {}: {}".format(link_id, n))
def loadLinkCharacteristics(self):
logging.info(self.link_characteristics[link_id].netem_at)
def load_link_characteristics(self):
"""
CAUTION: the path_i in config file is not taken into account. Hence place them in
increasing order in the topo parameter file!
"""
i = 0
for k in sorted(self.parameters):
# TODO FIXME rewrite this function
if k.startswith("path"):
tab = self.parameters[k].split(",")
bup = False
loss = "0.0"
if len(tab) == 5:
loss = tab[3]
bup = tab[4] == 'True'
bup = tab[4].lower() == 'true'
if len(tab) == 4:
try:
loss = float(tab[3])
loss = tab[3]
except ValueError:
bup = tab[3] == 'True'
bup = tab[3].lower() == 'true'
if len(tab) == 3 or len(tab) == 4 or len(tab) == 5:
path = LinkCharacteristics(i, tab[0],
tab[1], tab[2], loss, bup)
self.linkCharacteristics.append(path)
self.link_characteristics.append(path)
i = i + 1
else:
print("Ignored path :")
print(self.parameters[k])
def get(self, key):
val = Parameter.get(self, key)
if val is None:
if key in TopoParameter.DEFAULT_PARAMETERS:
return TopoParameter.DEFAULT_PARAMETERS[key]
else:
raise Exception("Param not found " + key)
else:
return val
logging.warning("Ignored path {}".format(self.parameters[k]))
def __str__(self):
s = Parameter.__str__(self)
s = s + "\n"
for p in self.linkCharacteristics[:-1]:
s = s + p.__str__() + "\n"
s = s + self.linkCharacteristics[-1].__str__()
s = "{}".format(super(TopoParameter, self).__str__())
s += "".join(["{}".format(lc) for lc in self.link_characteristics])
return s
class Topo(object):
@ -201,60 +200,65 @@ class Topo(object):
This class is not instantiable as it. You must define a child class with the
`NAME` attribute.
Attributes:
topo_builder instance of TopoBuilder
topo_parameter instance of TopoParameter
change_netem boolean indicating if netem must be changed
log_file file descriptor logging commands relative to the topo
"""
MININET_BUILDER = "mininet"
TOPO_ATTR = "topoType"
switchNamePrefix = "s"
routerNamePrefix = "r"
clientName = "Client"
serverName = "Server"
routerName = "Router"
cmdLog = "command.log"
SWITCH_NAME_PREFIX = "s"
ROUTER_NAME_PREFIX = "r"
CLIENT_NAME = "Client"
SERVER_NAME = "Server"
ROUTER_NAME = "Router"
CMD_LOG_FILENAME = "command.log"
"""Simple MpTopo"""
def __init__(self, topoBuilder, topoParam):
self.topoBuilder = topoBuilder
self.topoParam = topoParam
self.changeNetem = topoParam.get(TopoParameter.changeNetem)
self.logFile = open(Topo.cmdLog, 'w')
def __init__(self, topo_builder, topo_parameter):
self.topo_builder = topo_builder
self.topo_parameter = topo_parameter
self.change_netem = topo_parameter.get(TopoParameter.CHANGE_NETEM).lower() == "yes"
self.log_file = open(Topo.CMD_LOG_FILENAME, 'w')
def getLinkCharacteristics(self):
return self.topoParam.linkCharacteristics
def get_link_characteristics(self):
return self.topo_parameter.link_characteristics
def command_to(self, who, cmd):
self.logFile.write(who.__str__() + " : " + cmd + "\n")
return self.topoBuilder.command_to(who, cmd)
self.log_file.write("{} : {}\n".format(who, cmd))
return self.topo_builder.command_to(who, cmd)
def command_global(self, cmd):
"""
mainly use for not namespace sysctl.
"""
self.logFile.write("Not_NS" + " : " + cmd + "\n")
return self.topoBuilder.command_global(cmd)
self.log_file.write("Global : {}\n".format(cmd))
return self.topo_builder.command_global(cmd)
def get_host(self, who):
return self.topoBuilder.get_host(who)
return self.topo_builder.get_host(who)
def addHost(self, host):
return self.topoBuilder.addHost(host)
def add_host(self, host):
return self.topo_builder.add_host(host)
def addSwitch(self, switch):
return self.topoBuilder.addSwitch(switch)
def add_switch(self, switch):
return self.topo_builder.add_switch(switch)
def addLink(self, fromA, toB, **kwargs):
self.topoBuilder.addLink(fromA,toB,**kwargs)
def add_link(self, from_a, to_b, **kwargs):
self.topo_builder.add_link(from_a, to_b, **kwargs)
def get_cli(self):
self.topoBuilder.get_cli()
self.topo_builder.get_cli()
def start_network(self):
self.topoBuilder.start_network()
self.topo_builder.start_network()
def closeLogFile(self):
self.logFile.close()
def close_log_file(self):
self.log_file.close()
def stop_network(self):
self.topoBuilder.stop_network()
self.topo_builder.stop_network()
class TopoConfig(object):
@ -264,89 +268,78 @@ class TopoConfig(object):
This class is not instantiable as it. You must define a child class with the
`NAME` attribute.
"""
PING_OUTPUT = "ping.log"
def __init__(self, topo, param):
self.topo = topo
self.param = param
def configure_network(self):
print("Configure interfaces....Generic call ?")
self.configureInterfaces()
self.configureRoute()
logging.debug("Configure network in TopoConfig")
self.configure_interfaces()
self.configure_routing()
def disable_tso(self):
"""
Disable TSO on all interfaces
"""
links = self.topo.getLinkCharacteristics()
links = self.topo.get_link_characteristics()
for i, l in enumerate(links):
lname = self.getMidLeftName(i)
rname = self.getMidRightName(i)
lbox = self.topo.get_host(lname)
lbox = self.topo.get_host(self.getMidLeftName(i))
rbox = self.topo.get_host(self.getMidRightName(i))
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)
logging.info("Disable TSO on link between {} and {}".format(lif, rif))
cmd = "ethtool -K {} tso off".format(lif)
logging.info(cmd)
self.topo.command_to(lbox, cmd)
cmd = "ethtool -K " + rif + " tso off"
print(cmd)
cmd = "ethtool -K {} tso off".format(rif)
logging.info(cmd)
self.topo.command_to(rbox, cmd)
# And for the server
cmd = "ethtool -K " + self.getServerInterface() + " tso off"
print(cmd)
cmd = "ethtool -K {} tso off".format(self.get_server_interface())
logging.info(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)
cmd = "ethtool -K {} tso off".format(self.get_router_interface_to_switch(self.client_interface_count()))
logging.info(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":
if not self.topo.change_netem:
# Just rely on defaults of TCLink
logging.debug("No need to change netem")
logging.info("No need to change netem")
return
logging.info("Will change netem config on the fly")
links = self.topo.getLinkCharacteristics()
links = self.topo.get_link_characteristics()
for i, l in enumerate(links):
lname = self.getMidLeftName(i)
rname = self.getMidRightName(i)
lbox = self.topo.get_host(lname)
lbox = self.topo.get_host(self.getMidLeftName(i))
rbox = self.topo.get_host(self.getMidRightName(i))
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))
logging.info("Put netem command on link {} {}".format(lif, rif))
cmd = l.build_bandwidth_cmd(lif)
print(cmd)
logging.info(cmd)
self.topo.command_to(lbox, cmd)
cmd = l.build_bandwidth_cmd(rif)
print(cmd)
logging.info(cmd)
self.topo.command_to(rbox, cmd)
ilif = self.getMidL2RIncomingInterface(i)
irif = self.getMidR2LIncomingInterface(i)
cmd = l.build_policing_cmd(ilif)
print(cmd)
logging.info(cmd)
self.topo.command_to(lbox, cmd)
cmd = l.build_policing_cmd(irif)
print(cmd)
logging.info(cmd)
self.topo.command_to(rbox, cmd)
cmd = l.build_netem_cmd(irif)
print(cmd)
logging.info(cmd)
self.topo.command_to(rbox, cmd)
cmd = l.build_netem_cmd(ilif)
print(cmd)
logging.info(cmd)
self.topo.command_to(lbox, cmd)
def getMidL2RInterface(self, id):
@ -363,7 +356,16 @@ class TopoConfig(object):
def getMidRightName(self, i):
pass
def configureInterfaces(self):
def configure_interfaces(self):
"""
Function to override to configure the interfaces of the topology
"""
pass
def configure_routing(self):
"""
Function to override to configure the routing of the topology
"""
pass
def client_interface_count(self):
@ -384,51 +386,28 @@ class TopoConfig(object):
"""
raise NotImplementedError()
def interface_backup_command(self, interfaceName):
s = "/home/mininet/git/iproute-mptcp/ip/ip link set dev " + interfaceName + " multipath backup "
print(s)
return s
def interface_backup_command(self, interface_name):
return "ip link set dev {} multipath backup ".format(
interface_name)
def interfaceUpCommand(self, interfaceName, ip, subnet):
s = "ifconfig " + interfaceName + " " + ip + " netmask " + \
subnet
print(s)
return s
def interface_up_command(self, interface_name, ip, subnet):
return "ifconfig {} {} netmask {}".format(interface_name, ip, subnet)
def addRouteTableCommand(self, fromIP, id):
s = "ip rule add from " + fromIP + " table " + str(id + 1)
print(s)
return s
def add_table_route_command(self, from_ip, id):
return "ip rule add from {} table {}".format(from_ip, id + 1)
def addRouteScopeLinkCommand(self, network, interfaceName, id):
s = "ip route add " + network + " dev " + interfaceName + \
" scope link table " + str(id + 1)
print(s)
return s
def add_link_scope_route_command(self, network, interface_name, id):
return "ip route add {} dev {} scope link table {}".format(
network, interface_name, id + 1)
def addRouteDefaultCommand(self, via, id):
s = "ip route add default via " + via + " table " + str(id + 1)
print(s)
return s
def add_table_default_route_command(self, via, id):
return "ip route add default via {} table {}".format(via, id + 1)
def addRouteDefaultGlobalCommand(self, via, interfaceName):
s = "ip route add default scope global nexthop via " + via + \
" dev " + interfaceName
print(s)
return s
def add_global_default_route_command(self, via, interface_name):
return "ip route add default scope global nexthop via {} dev {}".format(via, interface_name)
def arpCommand(self, ip, mac):
s = "arp -s " + ip + " " + mac
print(s)
return s
def arp_command(self, ip, mac):
return "arp -s {} {}".format(ip, mac)
def addRouteDefaultSimple(self, via):
s = "ip route add default via " + via
print(s)
return s
def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + TopoConfig.PING_OUTPUT
print(s)
return s
def add_simple_default_route_command(self, via):
return "ip route add default via {}".format(via)

View File

@ -26,21 +26,6 @@ class AB(RandomFileExperiment):
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.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + AB.PING_OUTPUT
print(s)
return s
def load_parameters(self):
super(AB, self).load_parameters()
self.concurrent_requests = self.experiment_parameter.get(ABParameter.CONCURRENT_REQUESTS)

View File

@ -41,21 +41,6 @@ class DITG(Experiment):
self.load_parameters()
self.ping()
def ping(self):
self.topo.command_to(self.topo_config.client, "rm " + \
Experiment.PING_OUTPUT)
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + DITG.PING_OUTPUT
print(s)
return s
def load_parameters(self):
self.kbytes = self.experiment_parameter.get(DITGParameter.KBYTES)
self.constant_packet_size = self.experiment_parameter.get(DITGParameter.CONSTANT_PACKET_SIZE)

View File

@ -26,21 +26,6 @@ class Epload(Experiment):
self.load_parameters()
self.ping()
def ping(self):
self.topo.command_to(self.topo_config.client, "rm " + \
Epload.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + Epload.PING_OUTPUT
print(s)
return s
def load_parameters(self):
self.test_dir = self.experiment_parameter.get(EploadParameter.TEST_DIR)

View File

@ -13,21 +13,6 @@ class HTTP(RandomFileExperiment):
# Just rely on RandomFileExperiment
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.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + HTTP.PING_OUTPUT
print(s)
return s
def load_parameters(self):
# Just rely on RandomFileExperiment
super(HTTP, self).load_parameters()

View File

@ -13,21 +13,6 @@ class HTTPS(RandomFileExperiment):
# Just rely on RandomFileExperiment
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.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + HTTPS.PING_OUTPUT
print(s)
return s
def load_parameters(self):
# Just rely on RandomFileExperiment
super(HTTPS, self).load_parameters()

View File

@ -31,11 +31,11 @@ class IPerf(Experiment):
IPerf.PING_OUTPUT)
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
cmd = self.ping_command(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
def ping_command(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + IPerf.PING_OUTPUT
print(s)

View File

@ -36,11 +36,11 @@ class Msg(Experiment):
Msg.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
cmd = self.ping_command(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
def ping_command(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + Msg.PING_OUTPUT
print(s)

View File

@ -52,11 +52,11 @@ class NCPV(NC):
NCPV.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
cmd = self.ping_command(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
def ping_command(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + NCPV.PING_OUTPUT
print(s)

View File

@ -36,11 +36,11 @@ class Netperf(Experiment):
Netperf.PING_OUTPUT)
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
cmd = self.ping_command(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
def ping_command(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + Netperf.PING_OUTPUT
print(s)

View File

@ -19,11 +19,11 @@ class Ping(Experiment):
Ping.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
cmd = self.ping_command(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
def ping_command(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + Ping.PING_OUTPUT
print(s)

View File

@ -35,11 +35,11 @@ class QUIC(RandomFileExperiment):
QUIC.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
cmd = self.ping_command(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
def ping_command(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + QUIC.PING_OUTPUT
print(s)

View File

@ -34,11 +34,11 @@ class QUICSiri(Experiment):
QUICSiri.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
cmd = self.ping_command(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
def ping_command(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + QUICSiri.PING_OUTPUT
print(s)

View File

@ -18,11 +18,11 @@ class SendFile(RandomFileExperiment):
SendFile.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
cmd = self.ping_command(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
def ping_command(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + SendFile.PING_OUTPUT
print(s)

View File

@ -49,11 +49,11 @@ class Siri(Experiment):
Siri.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
cmd = self.ping_command(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
def ping_command(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + Siri.PING_OUTPUT
print(s)

View File

@ -23,11 +23,11 @@ class SiriHTTP(Siri, RandomFileExperiment):
SiriHTTP.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
cmd = self.ping_command(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
def ping_command(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + SiriHTTP.PING_OUTPUT
print(s)

View File

@ -31,11 +31,11 @@ class VLC(Experiment):
VLC.PING_OUTPUT )
count = self.experiment_parameter.get(ExperimentParameter.PING_COUNT)
for i in range(0, self.topo_config.client_interface_count()):
cmd = self.pingCommand(self.topo_config.getClientIP(i),
cmd = self.ping_command(self.topo_config.getClientIP(i),
self.topo_config.getServerIP(), n = count)
self.topo.command_to(self.topo_config.client, cmd)
def pingCommand(self, fromIP, toIP, n=5):
def ping_command(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + VLC.PING_OUTPUT
print(s)

View File

@ -100,7 +100,7 @@ if __name__ == '__main__':
args = parser.parse_args()
logging.basicConfig(level=logging.INFO)
logging.basicConfig(format="%(asctime)-15s [%(levelname)s] %(funcName)s: %(message)s", level=logging.INFO)
# XXX Currently, there is no alternate topo builder...
Runner(Topo.MININET_BUILDER, args.topo_param_file, args.experiment_param_file)

View File

@ -4,35 +4,35 @@ from struct import *
class ECMPSingleInterfaceTopo(Topo):
NAME = "ECMPLike"
def __init__(self, topoBuilder, parameterFile):
super(ECMPSingleInterfaceTopo, self).__init__(topoBuilder, parameterFile)
def __init__(self, topo_builder, parameterFile):
super(ECMPSingleInterfaceTopo, self).__init__(topo_builder, parameterFile)
print("Hello ECMP topo")
self.client = self.addHost(Topo.clientName)
self.server = self.addHost(Topo.serverName)
self.lswitch = self.addSwitch(Topo.switchNamePrefix + "0")
self.rswitch = self.addSwitch(Topo.switchNamePrefix + "1")
self.client = self.add_host(Topo.CLIENT_NAME)
self.server = self.add_host(Topo.SERVER_NAME)
self.lswitch = self.add_switch(Topo.SWITCH_NAME_PREFIX + "0")
self.rswitch = self.add_switch(Topo.SWITCH_NAME_PREFIX + "1")
self.addLink( self.client, self.lswitch)
self.addLink( self.server, self.rswitch)
self.add_link( self.client, self.lswitch)
self.add_link( self.server, self.rswitch)
self.routers = []
for l in self.topoParam.linkCharacteristics:
for l in self.topo_parameter.link_characteristics:
self.routers.append(self.addOneRouterPerLink(l))
print("added : " + self.routers[-1])
self.addLink(self.lswitch, self.routers[-1])
self.addLink(self.rswitch, self.routers[-1], **l.as_dict())
self.add_link(self.lswitch, self.routers[-1])
self.add_link(self.rswitch, self.routers[-1], **l.as_dict())
def addOneRouterPerLink(self, link):
return self.addHost(Topo.routerNamePrefix +
return self.add_host(Topo.ROUTER_NAME_PREFIX +
str(link.id))
def __str__(self):
s = "Single if ECMP like env\n"
i = 0
n = len(self.topoParam.linkCharacteristics)
for p in self.topoParam.linkCharacteristics:
n = len(self.topo_parameter.link_characteristics)
for p in self.topo_parameter.link_characteristics:
if i == n // 2:
if n % 2 == 0:
s = s + "c---sw sw-----s\n"
@ -52,7 +52,7 @@ class ECMPSingleInterfaceConfig(TopoConfig):
def __init__(self, topo, param):
super(ECMPSingleInterfaceConfig, self).__init__(topo, param)
def configureRoute(self):
def configure_routing(self):
i = 0
mask = len(self.topo.routers) - 1
for l in self.topo.routers:
@ -79,10 +79,10 @@ class ECMPSingleInterfaceConfig(TopoConfig):
i = i + 1
###
cmd = self.addRouteDefaultSimple(self.getRouterIPServer(0))
cmd = self.add_simple_default_route_command(self.getRouterIPServer(0))
self.topo.command_to(self.server, cmd)
cmd = self.addRouteDefaultSimple(self.getRouterIPClient(0))
cmd = self.add_simple_default_route_command(self.getRouterIPClient(0))
self.topo.command_to(self.client, cmd)
self.topo.command_to(self.client, "ip route flush cache")
@ -129,57 +129,57 @@ class ECMPSingleInterfaceConfig(TopoConfig):
print(s)
return s
def configureInterfaces(self):
self.client = self.topo.get_host(Topo.clientName)
self.server = self.topo.get_host(Topo.serverName)
def configure_interfaces(self):
self.client = self.topo.get_host(Topo.CLIENT_NAME)
self.server = self.topo.get_host(Topo.SERVER_NAME)
self.routers = []
i = 0
netmask = "255.255.255.0"
for l in self.topo.routers:
self.routers.append(self.topo.get_host(
Topo.routerNamePrefix + str(i)))
cmd = self.interfaceUpCommand(
Topo.ROUTER_NAME_PREFIX + str(i)))
cmd = self.interface_up_command(
self.getRouterInterfaceLSwitch(i),
self.getRouterIPClient(i), netmask)
self.topo.command_to(self.routers[-1] , cmd)
cmd = self.interfaceUpCommand(
cmd = self.interface_up_command(
self.getRouterInterfaceRSwitch(i),
self.getRouterIPServer(i), netmask)
self.topo.command_to(self.routers[-1] , cmd)
i = i + 1
cmd = self.interfaceUpCommand(self.get_client_interface(0),
cmd = self.interface_up_command(self.get_client_interface(0),
self.getClientIP(0), netmask)
self.topo.command_to(self.client, cmd)
cmd = self.interfaceUpCommand(self.getServerInterface(),
cmd = self.interface_up_command(self.get_server_interface(),
self.getServerIP(), netmask)
self.topo.command_to(self.server, cmd)
def getClientIP(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP
def getClientSubnet(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
clientSubnet = lSubnet + str(interfaceID) + ".0/24"
return clientSubnet
def getRouterIPClient(self, id):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
routerIP = lSubnet + "0." + str(id + 2)
return routerIP
def getRouterIPServer(self, id):
rSubnet = self.param.get(TopoParameter.RSUBNET)
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
routerIP = rSubnet + "0." + str(id + 2)
return routerIP
def getServerIP(self):
rSubnet = self.param.get(TopoParameter.RSUBNET)
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
serverIP = rSubnet + "0.1"
return serverIP
@ -187,22 +187,22 @@ class ECMPSingleInterfaceConfig(TopoConfig):
return 1
def getRouterInterfaceLSwitch(self, id):
return Topo.routerNamePrefix + str(id) + "-eth0"
return Topo.ROUTER_NAME_PREFIX + str(id) + "-eth0"
def getRouterInterfaceRSwitch(self, id):
return Topo.routerNamePrefix + str(id) + "-eth1"
return Topo.ROUTER_NAME_PREFIX + str(id) + "-eth1"
def get_client_interface(self, interfaceID):
return Topo.clientName + "-eth" + str(interfaceID)
return Topo.CLIENT_NAME + "-eth" + str(interfaceID)
def getServerInterface(self):
return Topo.serverName + "-eth0"
def get_server_interface(self):
return Topo.SERVER_NAME + "-eth0"
def getMidLeftName(self, id):
return Topo.routerNamePrefix + str(id)
return Topo.ROUTER_NAME_PREFIX + str(id)
def getMidRightName(self, id):
return Topo.switchNamePrefix + "1"
return Topo.SWITCH_NAME_PREFIX + "1"
def getMidL2RInterface(self, id):
return self.getMidLeftName(id) + "-eth1"

View File

@ -3,35 +3,35 @@ from core.topo import Topo, TopoConfig, TopoParameter
class MultiInterfaceTopo(Topo):
NAME = "MultiIf"
def __init__(self, topoBuilder, parameterFile):
super(MultiInterfaceTopo, self).__init__(topoBuilder, parameterFile)
def __init__(self, topo_builder, parameterFile):
super(MultiInterfaceTopo, self).__init__(topo_builder, parameterFile)
print("Hello from topo multi if")
self.client = self.addHost(Topo.clientName)
self.server = self.addHost(Topo.serverName)
self.router = self.addHost(Topo.routerName)
self.client = self.add_host(Topo.CLIENT_NAME)
self.server = self.add_host(Topo.SERVER_NAME)
self.router = self.add_host(Topo.ROUTER_NAME)
self.switchClient = []
self.switchServer = []
for l in self.topoParam.linkCharacteristics:
self.switchClient.append(self.addSwitch1ForLink(l))
self.addLink(self.client,self.switchClient[-1])
self.switchServer.append(self.addSwitch2ForLink(l))
self.addLink(self.switchClient[-1], self.switchServer[-1], **l.as_dict())
self.addLink(self.switchServer[-1],self.router)
self.addLink(self.router, self.server)
for l in self.topo_parameter.link_characteristics:
self.switchClient.append(self.add_switch1ForLink(l))
self.add_link(self.client,self.switchClient[-1])
self.switchServer.append(self.add_switch2ForLink(l))
self.add_link(self.switchClient[-1], self.switchServer[-1], **l.as_dict())
self.add_link(self.switchServer[-1],self.router)
self.add_link(self.router, self.server)
def addSwitch1ForLink(self, link):
return self.addSwitch(MultiInterfaceTopo.switchNamePrefix +
def add_switch1ForLink(self, link):
return self.add_switch(MultiInterfaceTopo.SWITCH_NAME_PREFIX +
str(2 * link.id))
def addSwitch2ForLink(self, link):
return self.addSwitch(MultiInterfaceTopo.switchNamePrefix +
def add_switch2ForLink(self, link):
return self.add_switch(MultiInterfaceTopo.SWITCH_NAME_PREFIX +
str(2 * link.id + 1))
def __str__(self):
s = "Simple multiple interface topolgy \n"
i = 0
n = len(self.topoParam.linkCharacteristics)
for p in self.topoParam.linkCharacteristics:
n = len(self.topo_parameter.link_characteristics)
for p in self.topo_parameter.link_characteristics:
if i == n // 2:
if n % 2 == 0:
s = s + "c r-----s\n"
@ -50,40 +50,40 @@ class MultiInterfaceConfig(TopoConfig):
def __init__(self, topo, param):
super(MultiInterfaceConfig, self).__init__(topo, param)
def configureRoute(self):
def configure_routing(self):
i = 0
for l in self.topo.switchClient:
cmd = self.addRouteTableCommand(self.getClientIP(i), i)
cmd = self.add_table_route_command(self.getClientIP(i), i)
self.topo.command_to(self.client, cmd)
cmd = self.addRouteScopeLinkCommand(
cmd = self.add_link_scope_route_command(
self.getClientSubnet(i),
self.get_client_interface(i), i)
self.topo.command_to(self.client, cmd)
cmd = self.addRouteDefaultCommand(self.getRouterIPSwitch(i),
cmd = self.add_table_default_route_command(self.getRouterIPSwitch(i),
i)
self.topo.command_to(self.client, cmd)
i = i + 1
cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0),
cmd = self.add_global_default_route_command(self.getRouterIPSwitch(0),
self.get_client_interface(0))
self.topo.command_to(self.client, cmd)
cmd = self.addRouteDefaultSimple(self.getRouterIPServer())
cmd = self.add_simple_default_route_command(self.getRouterIPServer())
self.topo.command_to(self.server, cmd)
def configureInterfaces(self):
def configure_interfaces(self):
print("Configure interfaces for multi inf")
self.client = self.topo.get_host(Topo.clientName)
self.server = self.topo.get_host(Topo.serverName)
self.router = self.topo.get_host(Topo.routerName)
self.client = self.topo.get_host(Topo.CLIENT_NAME)
self.server = self.topo.get_host(Topo.SERVER_NAME)
self.router = self.topo.get_host(Topo.ROUTER_NAME)
i = 0
netmask = "255.255.255.0"
links = self.topo.getLinkCharacteristics()
links = self.topo.get_link_characteristics()
for l in self.topo.switchClient:
cmd = self.interfaceUpCommand(
cmd = self.interface_up_command(
self.get_client_interface(i),
self.getClientIP(i), netmask)
self.topo.command_to(self.client, cmd)
@ -99,7 +99,7 @@ class MultiInterfaceConfig(TopoConfig):
i = 0
for l in self.topo.switchServer:
cmd = self.interfaceUpCommand(
cmd = self.interface_up_command(
self.get_router_interface_to_switch(i),
self.getRouterIPSwitch(i), netmask)
self.topo.command_to(self.router, cmd)
@ -108,40 +108,40 @@ class MultiInterfaceConfig(TopoConfig):
print(str(links[i]))
i = i + 1
cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(),
cmd = self.interface_up_command(self.getRouterInterfaceServer(),
self.getRouterIPServer(), netmask)
self.topo.command_to(self.router, cmd)
routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC()
self.topo.command_to(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac)
cmd = self.interfaceUpCommand(self.getServerInterface(),
cmd = self.interface_up_command(self.get_server_interface(),
self.getServerIP(), netmask)
self.topo.command_to(self.server, cmd)
serverIntfMac = self.server.intf(self.getServerInterface()).MAC()
serverIntfMac = self.server.intf(self.get_server_interface()).MAC()
self.topo.command_to(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac)
def getClientIP(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP
def getClientSubnet(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
clientSubnet = lSubnet + str(interfaceID) + ".0/24"
return clientSubnet
def getRouterIPSwitch(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
routerIP = lSubnet + str(interfaceID) + ".2"
return routerIP
def getRouterIPServer(self):
rSubnet = self.param.get(TopoParameter.RSUBNET)
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
routerIP = rSubnet + "0.2"
return routerIP
def getServerIP(self):
rSubnet = self.param.get(TopoParameter.RSUBNET)
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
serverIP = rSubnet + "0.1"
return serverIP
@ -152,19 +152,19 @@ class MultiInterfaceConfig(TopoConfig):
return self.get_router_interface_to_switch(len(self.topo.switchServer))
def get_client_interface(self, interfaceID):
return Topo.clientName + "-eth" + str(interfaceID)
return Topo.CLIENT_NAME + "-eth" + str(interfaceID)
def get_router_interface_to_switch(self, interfaceID):
return Topo.routerName + "-eth" + str(interfaceID)
return Topo.ROUTER_NAME + "-eth" + str(interfaceID)
def getServerInterface(self):
return Topo.serverName + "-eth0"
def get_server_interface(self):
return Topo.SERVER_NAME + "-eth0"
def getSwitchClientName(self, id):
return Topo.switchNamePrefix + str(2 * id)
return Topo.SWITCH_NAME_PREFIX + str(2 * id)
def getSwitchServerName(self, id):
return Topo.switchNamePrefix + str(2 * id + 1)
return Topo.SWITCH_NAME_PREFIX + str(2 * id + 1)
def getMidLeftName(self, id):
return self.getSwitchClientName(id)

View File

@ -7,25 +7,25 @@ class MultiInterfaceCongTopo(Topo):
congClientName = "CCli"
congServerName = "CSer"
def __init__(self, topoBuilder, parameterFile):
super(MultiInterfaceCongTopo, self).__init__(topoBuilder, parameterFile)
def __init__(self, topo_builder, parameterFile):
super(MultiInterfaceCongTopo, self).__init__(topo_builder, parameterFile)
print("Hello from topo multi if")
self.client = self.addHost(Topo.clientName)
self.server = self.addHost(Topo.serverName)
self.router = self.addHost(Topo.routerName)
self.client = self.add_host(Topo.CLIENT_NAME)
self.server = self.add_host(Topo.SERVER_NAME)
self.router = self.add_host(Topo.ROUTER_NAME)
self.cong_clients = []
self.cong_servers = []
self.switch = []
for l in self.topoParam.linkCharacteristics:
for l in self.topo_parameter.link_characteristics:
self.switch.append(self.addOneSwitchPerLink(l))
self.addLink(self.client,self.switch[-1])
self.cong_clients.append(self.addHost(MultiInterfaceCongTopo.congClientName + str(len(self.cong_clients))))
self.addLink(self.cong_clients[-1], self.switch[-1])
self.addLink(self.switch[-1],self.router, **l.as_dict())
self.addLink(self.router, self.server)
self.add_link(self.client,self.switch[-1])
self.cong_clients.append(self.add_host(MultiInterfaceCongTopo.congClientName + str(len(self.cong_clients))))
self.add_link(self.cong_clients[-1], self.switch[-1])
self.add_link(self.switch[-1],self.router, **l.as_dict())
self.add_link(self.router, self.server)
for i in range(len(self.cong_clients)):
self.cong_servers.append(self.addHost(MultiInterfaceCongTopo.congServerName + str(len(self.cong_servers))))
self.addLink(self.router, self.cong_servers[-1])
self.cong_servers.append(self.add_host(MultiInterfaceCongTopo.congServerName + str(len(self.cong_servers))))
self.add_link(self.router, self.cong_servers[-1])
def getCongClients(self):
return self.cong_clients
@ -34,14 +34,14 @@ class MultiInterfaceCongTopo(Topo):
return self.cong_servers
def addOneSwitchPerLink(self, link):
return self.addSwitch(MultiInterfaceCongTopo.switchNamePrefix +
return self.add_switch(MultiInterfaceCongTopo.SWITCH_NAME_PREFIX +
str(link.id))
def __str__(self):
s = "Simple multiple interface topology with congestion \n"
i = 0
n = len(self.topoParam.linkCharacteristics)
for p in self.topoParam.linkCharacteristics:
n = len(self.topo_parameter.link_characteristics)
for p in self.topo_parameter.link_characteristics:
if i == n // 2:
if n % 2 == 0:
s = s + "c r-----s\n"
@ -61,28 +61,28 @@ class MultiInterfaceCongConfig(TopoConfig):
def __init__(self, topo, param):
super(MultiInterfaceCongConfig, self).__init__(topo, param)
def configureRoute(self):
def configure_routing(self):
i = 0
for l in self.topo.switch:
cmd = self.addRouteTableCommand(self.getClientIP(i), i)
cmd = self.add_table_route_command(self.getClientIP(i), i)
self.topo.command_to(self.client, cmd)
# Congestion client
cmd = self.addRouteTableCommand(self.getCongClientIP(i), i)
cmd = self.add_table_route_command(self.getCongClientIP(i), i)
self.topo.command_to(self.cong_clients[i], cmd)
cmd = self.addRouteScopeLinkCommand(
cmd = self.add_link_scope_route_command(
self.getClientSubnet(i),
self.get_client_interface(i), i)
self.topo.command_to(self.client, cmd)
# Congestion client
cmd = self.addRouteScopeLinkCommand(
cmd = self.add_link_scope_route_command(
self.getClientSubnet(i),
self.getCongClientInterface(i), i)
self.topo.command_to(self.cong_clients[i], cmd)
cmd = self.addRouteDefaultCommand(self.getRouterIPSwitch(i),
cmd = self.add_table_default_route_command(self.getRouterIPSwitch(i),
i)
self.topo.command_to(self.client, cmd)
@ -91,37 +91,37 @@ class MultiInterfaceCongConfig(TopoConfig):
self.topo.command_to(self.cong_clients[i], cmd)
# Congestion client
cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(i),
cmd = self.add_global_default_route_command(self.getRouterIPSwitch(i),
self.getCongClientInterface(i))
i = i + 1
cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0),
cmd = self.add_global_default_route_command(self.getRouterIPSwitch(0),
self.get_client_interface(0))
self.topo.command_to(self.client, cmd)
# Congestion Client
i = 0
for c in self.cong_clients:
cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(i),
cmd = self.add_global_default_route_command(self.getRouterIPSwitch(i),
self.getCongClientInterface(i))
self.topo.command_to(c, cmd)
i = i + 1
cmd = self.addRouteDefaultSimple(self.getRouterIPServer())
cmd = self.add_simple_default_route_command(self.getRouterIPServer())
self.topo.command_to(self.server, cmd)
# Congestion servers
i = 0
for s in self.cong_servers:
cmd = self.addRouteDefaultSimple(self.getRouterIPCongServer(i))
cmd = self.add_simple_default_route_command(self.getRouterIPCongServer(i))
self.topo.command_to(s, cmd)
i += 1
def configureInterfaces(self):
def configure_interfaces(self):
print("Configure interfaces for multi inf")
self.client = self.topo.get_host(Topo.clientName)
self.server = self.topo.get_host(Topo.serverName)
self.router = self.topo.get_host(Topo.routerName)
self.client = self.topo.get_host(Topo.CLIENT_NAME)
self.server = self.topo.get_host(Topo.SERVER_NAME)
self.router = self.topo.get_host(Topo.ROUTER_NAME)
cong_client_names = self.topo.getCongClients()
self.cong_clients = []
for cn in cong_client_names:
@ -134,9 +134,9 @@ class MultiInterfaceCongConfig(TopoConfig):
i = 0
netmask = "255.255.255.0"
links = self.topo.getLinkCharacteristics()
links = self.topo.get_link_characteristics()
for l in self.topo.switch:
cmd = self.interfaceUpCommand(
cmd = self.interface_up_command(
self.get_client_interface(i),
self.getClientIP(i), netmask)
self.topo.command_to(self.client, cmd)
@ -149,14 +149,14 @@ class MultiInterfaceCongConfig(TopoConfig):
self.topo.command_to(self.client, cmd)
# Congestion client
cmd = self.interfaceUpCommand(
cmd = self.interface_up_command(
self.getCongClientInterface(i),
self.getCongClientIP(i), netmask)
self.topo.command_to(self.cong_clients[i], cmd)
congClientIntfMac = self.cong_clients[i].intf(self.getCongClientInterface(i)).MAC()
self.topo.command_to(self.router, "arp -s " + self.getCongClientIP(i) + " " + congClientIntfMac)
cmd = self.interfaceUpCommand(
cmd = self.interface_up_command(
self.get_router_interface_to_switch(i),
self.getRouterIPSwitch(i), netmask)
self.topo.command_to(self.router, cmd)
@ -167,28 +167,28 @@ class MultiInterfaceCongConfig(TopoConfig):
print(str(links[i]))
i = i + 1
cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(),
cmd = self.interface_up_command(self.getRouterInterfaceServer(),
self.getRouterIPServer(), netmask)
self.topo.command_to(self.router, cmd)
routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC()
self.topo.command_to(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac)
cmd = self.interfaceUpCommand(self.getServerInterface(),
cmd = self.interface_up_command(self.get_server_interface(),
self.getServerIP(), netmask)
self.topo.command_to(self.server, cmd)
serverIntfMac = self.server.intf(self.getServerInterface()).MAC()
serverIntfMac = self.server.intf(self.get_server_interface()).MAC()
self.topo.command_to(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac)
# Congestion servers
i = 0
for s in self.cong_servers:
cmd = self.interfaceUpCommand(self.getRouterInterfaceCongServer(i),
cmd = self.interface_up_command(self.getRouterInterfaceCongServer(i),
self.getRouterIPCongServer(i), netmask)
self.topo.command_to(self.router, cmd)
routerIntfMac = self.router.intf(self.getRouterInterfaceCongServer(i)).MAC()
self.topo.command_to(s, "arp -s " + self.getRouterIPCongServer(i) + " " + routerIntfMac)
cmd = self.interfaceUpCommand(self.getCongServerInterface(i),
cmd = self.interface_up_command(self.getCongServerInterface(i),
self.getCongServerIP(i), netmask)
self.topo.command_to(s, cmd)
congServerIntfMac = s.intf(self.getCongServerInterface(i)).MAC()
@ -196,42 +196,42 @@ class MultiInterfaceCongConfig(TopoConfig):
i = i + 1
def getClientIP(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP
def getCongClientIP(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
congClientIP = lSubnet + str(interfaceID) + ".127"
return congClientIP
def getClientSubnet(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
clientSubnet = lSubnet + str(interfaceID) + ".0/24"
return clientSubnet
def getRouterIPSwitch(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
routerIP = lSubnet + str(interfaceID) + ".2"
return routerIP
def getRouterIPServer(self):
rSubnet = self.param.get(TopoParameter.RSUBNET)
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
routerIP = rSubnet + "0.2"
return routerIP
def getRouterIPCongServer(self, congID):
rSubnet = self.param.get(TopoParameter.RSUBNET)
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
routerIP = rSubnet + str(1 + congID) + ".2"
return routerIP
def getServerIP(self):
rSubnet = self.param.get(TopoParameter.RSUBNET)
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
serverIP = rSubnet + "0.1"
return serverIP
def getCongServerIP(self, congID):
rSubnet = self.param.get(TopoParameter.RSUBNET)
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
serverIP = rSubnet + str(1 + congID) + ".1"
return serverIP
@ -245,25 +245,25 @@ class MultiInterfaceCongConfig(TopoConfig):
return self.get_router_interface_to_switch(len(self.topo.switch) + 1 + congID)
def get_client_interface(self, interfaceID):
return Topo.clientName + "-eth" + str(interfaceID)
return Topo.CLIENT_NAME + "-eth" + str(interfaceID)
def getCongClientInterface(self, interfaceID):
return MultiInterfaceCongConfig.congClientName + str(interfaceID) + "-eth0"
def get_router_interface_to_switch(self, interfaceID):
return Topo.routerName + "-eth" + str(interfaceID)
return Topo.ROUTER_NAME + "-eth" + str(interfaceID)
def getServerInterface(self):
return Topo.serverName + "-eth0"
def get_server_interface(self):
return Topo.SERVER_NAME + "-eth0"
def getCongServerInterface(self, interfaceID):
return MultiInterfaceCongConfig.congServerName + str(interfaceID) + "-eth0"
def getMidLeftName(self, id):
return Topo.switchNamePrefix + str(id)
return Topo.SWITCH_NAME_PREFIX + str(id)
def getMidRightName(self, id):
return Topo.routerName
return Topo.ROUTER_NAME
def getMidL2RInterface(self, id):
return self.getMidLeftName(id) + "-eth2"

View File

@ -4,8 +4,8 @@ from core.topo import Topo, TopoConfig, TopoParameter
class TwoInterfaceCongestionTopo(Topo):
NAME = "twoIfCong"
def __init__(self, topoBuilder, parameterFile):
super(TwoInterfaceCongestionTopo, self).__init__(topoBuilder, parameterFile)
def __init__(self, topo_builder, parameterFile):
super(TwoInterfaceCongestionTopo, self).__init__(topo_builder, parameterFile)
print("Hello from topo two ifs cong")
print("Expected topo:")
@ -14,37 +14,37 @@ class TwoInterfaceCongestionTopo(Topo):
print(" | |------s2")
print("c2----link2----")
self.client = self.addHost(Topo.clientName)
self.clientCong = self.addHost(Topo.clientName + "Cong")
self.server = self.addHost(Topo.serverName)
self.serverCong = self.addHost(Topo.serverName + "Cong")
self.router = self.addHost(Topo.routerName)
self.routerCong = self.addHost(Topo.routerName + "Cong")
self.client = self.add_host(Topo.CLIENT_NAME)
self.clientCong = self.add_host(Topo.CLIENT_NAME + "Cong")
self.server = self.add_host(Topo.SERVER_NAME)
self.serverCong = self.add_host(Topo.SERVER_NAME + "Cong")
self.router = self.add_host(Topo.ROUTER_NAME)
self.routerCong = self.add_host(Topo.ROUTER_NAME + "Cong")
self.switch = []
# Link between c1 and r2
self.switch.append(self.addOneSwitchPerLink(self.topoParam.linkCharacteristics[0]))
self.addLink(self.client, self.switch[-1])
self.addLink(self.switch[-1], self.router, **self.topoParam.linkCharacteristics[0].as_dict())
self.switch.append(self.addOneSwitchPerLink(self.topo_parameter.link_characteristics[0]))
self.add_link(self.client, self.switch[-1])
self.add_link(self.switch[-1], self.router, **self.topo_parameter.link_characteristics[0].as_dict())
# Link between c1 and r1
self.addLink(self.client, self.routerCong)
self.add_link(self.client, self.routerCong)
# Link between c2 and r1
self.switch.append(self.addOneSwitchPerLink(self.topoParam.linkCharacteristics[2]))
self.addLink(self.clientCong, self.switch[-1])
self.addLink(self.switch[-1], self.routerCong, **self.topoParam.linkCharacteristics[2].as_dict())
self.switch.append(self.addOneSwitchPerLink(self.topo_parameter.link_characteristics[2]))
self.add_link(self.clientCong, self.switch[-1])
self.add_link(self.switch[-1], self.routerCong, **self.topo_parameter.link_characteristics[2].as_dict())
# Link between r1 and r2
self.switch.append(self.addOneSwitchPerLink(self.topoParam.linkCharacteristics[1]))
self.addLink(self.routerCong, self.switch[-1])
self.addLink(self.switch[-1], self.router, **self.topoParam.linkCharacteristics[1].as_dict())
self.switch.append(self.addOneSwitchPerLink(self.topo_parameter.link_characteristics[1]))
self.add_link(self.routerCong, self.switch[-1])
self.add_link(self.switch[-1], self.router, **self.topo_parameter.link_characteristics[1].as_dict())
# Link between r2 and s1
self.addLink(self.router, self.server)
self.add_link(self.router, self.server)
# Link between r2 and s2
self.addLink(self.router, self.serverCong)
self.add_link(self.router, self.serverCong)
def __str__(self):
s = "Hello from topo two ifs cong \n"
@ -55,7 +55,7 @@ class TwoInterfaceCongestionTopo(Topo):
return s
def addOneSwitchPerLink(self, link):
return self.addSwitch(Topo.switchNamePrefix + str(link.id))
return self.add_switch(Topo.SWITCH_NAME_PREFIX + str(link.id))
class TwoInterfaceCongestionConfig(TopoConfig):
@ -64,158 +64,158 @@ class TwoInterfaceCongestionConfig(TopoConfig):
def __init__(self, topo, param):
super(TwoInterfaceCongestionConfig, self).__init__(topo, param)
def configureRoute(self):
def configure_routing(self):
# Client - Router
cmd = self.addRouteTableCommand("10.0.0.1", 0)
cmd = self.add_table_route_command("10.0.0.1", 0)
self.topo.command_to(self.client, cmd)
cmd = self.addRouteScopeLinkCommand("10.0.0.0/24", Topo.clientName + "-eth0", 0)
cmd = self.add_link_scope_route_command("10.0.0.0/24", Topo.CLIENT_NAME + "-eth0", 0)
self.topo.command_to(self.client, cmd)
cmd = self.addRouteDefaultCommand("10.0.0.2", 0)
cmd = self.add_table_default_route_command("10.0.0.2", 0)
self.topo.command_to(self.client, cmd)
# Client -> Router cong
cmd = self.addRouteTableCommand("10.0.1.1", 1)
cmd = self.add_table_route_command("10.0.1.1", 1)
self.topo.command_to(self.client, cmd)
cmd = self.addRouteScopeLinkCommand("10.0.1.0/24", Topo.clientName + "-eth1", 1)
cmd = self.add_link_scope_route_command("10.0.1.0/24", Topo.CLIENT_NAME + "-eth1", 1)
self.topo.command_to(self.client, cmd)
cmd = self.addRouteDefaultCommand("10.0.1.2", 1)
cmd = self.add_table_default_route_command("10.0.1.2", 1)
self.topo.command_to(self.client, cmd)
# Client cong -> Router cong
cmd = self.addRouteTableCommand("10.0.2.1", 0)
cmd = self.add_table_route_command("10.0.2.1", 0)
self.topo.command_to(self.clientCong, cmd)
cmd = self.addRouteScopeLinkCommand("10.0.2.0/24", Topo.clientName + "Cong-eth0", 0)
cmd = self.add_link_scope_route_command("10.0.2.0/24", Topo.CLIENT_NAME + "Cong-eth0", 0)
self.topo.command_to(self.clientCong, cmd)
cmd = self.addRouteDefaultCommand("10.0.2.2", 0)
cmd = self.add_table_default_route_command("10.0.2.2", 0)
self.topo.command_to(self.clientCong, cmd)
# Router cong -> Router
cmd = self.addRouteTableCommand("10.0.3.1", 0)
cmd = self.add_table_route_command("10.0.3.1", 0)
self.topo.command_to(self.routerCong, cmd)
cmd = self.addRouteScopeLinkCommand("10.1.0.0/16", Topo.routerName + "Cong-eth2", 0)
cmd = self.add_link_scope_route_command("10.1.0.0/16", Topo.ROUTER_NAME + "Cong-eth2", 0)
self.topo.command_to(self.routerCong, cmd)
cmd = self.addRouteDefaultCommand("10.0.3.2", 0)
cmd = self.add_table_default_route_command("10.0.3.2", 0)
self.topo.command_to(self.routerCong, cmd)
# Router -> Router cong
cmd = self.addRouteTableCommand("10.0.3.2", 0)
cmd = self.add_table_route_command("10.0.3.2", 0)
self.topo.command_to(self.router, cmd)
cmd = self.addRouteScopeLinkCommand("10.0.0.0/16", Topo.routerName + "-eth1", 0)
cmd = self.add_link_scope_route_command("10.0.0.0/16", Topo.ROUTER_NAME + "-eth1", 0)
self.topo.command_to(self.router, cmd)
cmd = self.addRouteDefaultCommand("10.0.3.1", 0)
cmd = self.add_table_default_route_command("10.0.3.1", 0)
self.topo.command_to(self.router, cmd)
# Default route Client
cmd = self.addRouteDefaultGlobalCommand("10.0.0.2", Topo.clientName + "-eth0")
cmd = self.add_global_default_route_command("10.0.0.2", Topo.CLIENT_NAME + "-eth0")
self.topo.command_to(self.client, cmd)
# Default route Client cong
cmd = self.addRouteDefaultGlobalCommand("10.0.2.2", Topo.clientName + "Cong-eth0")
cmd = self.add_global_default_route_command("10.0.2.2", Topo.CLIENT_NAME + "Cong-eth0")
self.topo.command_to(self.clientCong, cmd)
# Default route Router cong
cmd = self.addRouteDefaultGlobalCommand("10.0.3.2", Topo.routerName + "Cong-eth2")
cmd = self.add_global_default_route_command("10.0.3.2", Topo.ROUTER_NAME + "Cong-eth2")
self.topo.command_to(self.routerCong, cmd)
# Default route Router
cmd = self.addRouteDefaultGlobalCommand("10.0.3.1", Topo.routerName + "-eth1")
cmd = self.add_global_default_route_command("10.0.3.1", Topo.ROUTER_NAME + "-eth1")
self.topo.command_to(self.router, cmd)
# Default route Server
cmd = self.addRouteDefaultGlobalCommand("10.1.0.2", Topo.serverName + "-eth0")
cmd = self.add_global_default_route_command("10.1.0.2", Topo.SERVER_NAME + "-eth0")
self.topo.command_to(self.server, cmd)
# Default route Server cong
cmd = self.addRouteDefaultGlobalCommand("10.1.1.2", Topo.serverName + "Cong-eth0")
cmd = self.add_global_default_route_command("10.1.1.2", Topo.SERVER_NAME + "Cong-eth0")
self.topo.command_to(self.serverCong, cmd)
def configureInterface(self, srcHost, dstHost, srcInterfaceName, srcIP, netmask):
cmd = self.interfaceUpCommand(srcInterfaceName, srcIP, netmask)
cmd = self.interface_up_command(srcInterfaceName, srcIP, netmask)
self.topo.command_to(srcHost, cmd)
mac = srcHost.intf(srcInterfaceName).MAC()
cmd = self.arpCommand(srcIP, mac)
cmd = self.arp_command(srcIP, mac)
self.topo.command_to(dstHost, cmd)
def configureInterfaces(self):
def configure_interfaces(self):
print("Configure interfaces for two inf cong")
self.client = self.topo.get_host(Topo.clientName)
self.clientCong = self.topo.get_host(Topo.clientName + "Cong")
self.server = self.topo.get_host(Topo.serverName)
self.serverCong = self.topo.get_host(Topo.serverName + "Cong")
self.router = self.topo.get_host(Topo.routerName)
self.routerCong = self.topo.get_host(Topo.routerName + "Cong")
self.client = self.topo.get_host(Topo.CLIENT_NAME)
self.clientCong = self.topo.get_host(Topo.CLIENT_NAME + "Cong")
self.server = self.topo.get_host(Topo.SERVER_NAME)
self.serverCong = self.topo.get_host(Topo.SERVER_NAME + "Cong")
self.router = self.topo.get_host(Topo.ROUTER_NAME)
self.routerCong = self.topo.get_host(Topo.ROUTER_NAME + "Cong")
netmask = "255.255.255.0"
links = self.topo.getLinkCharacteristics()
links = self.topo.get_link_characteristics()
# Link 0: Client - Router
self.configureInterface(self.client, self.router, Topo.clientName + "-eth0", "10.0.0.1", netmask)
self.configureInterface(self.client, self.router, Topo.CLIENT_NAME + "-eth0", "10.0.0.1", netmask)
if(links[0].backup):
cmd = self.interface_backup_command(Topo.clientName + "-eth0")
cmd = self.interface_backup_command(Topo.CLIENT_NAME + "-eth0")
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.ROUTER_NAME + "-eth0", "10.0.0.2", netmask)
print(str(links[0]))
# Client - Router cong
self.configureInterface(self.client, self.routerCong, Topo.clientName + "-eth1", "10.0.1.1", netmask)
self.configureInterface(self.client, self.routerCong, Topo.CLIENT_NAME + "-eth1", "10.0.1.1", netmask)
if(links[1].backup):
cmd = self.interface_backup_command(Topo.clientName + "-eth1")
cmd = self.interface_backup_command(Topo.CLIENT_NAME + "-eth1")
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.ROUTER_NAME + "Cong-eth0", "10.0.1.2", netmask)
# Link 1: Router - Router cong
self.configureInterface(self.routerCong, self.router, Topo.routerName + "Cong-eth2", "10.0.3.1", netmask)
self.configureInterface(self.router, self.routerCong, Topo.routerName + "-eth1", "10.0.3.2", netmask)
self.configureInterface(self.routerCong, self.router, Topo.ROUTER_NAME + "Cong-eth2", "10.0.3.1", netmask)
self.configureInterface(self.router, self.routerCong, Topo.ROUTER_NAME + "-eth1", "10.0.3.2", netmask)
print(str(links[1]))
# Link 2: Client cong - Router cong
self.configureInterface(self.clientCong, self.routerCong, Topo.clientName + "Cong-eth0", "10.0.2.1", netmask)
self.configureInterface(self.routerCong, self.clientCong, Topo.routerName + "Cong-eth1", "10.0.2.2", netmask)
self.configureInterface(self.clientCong, self.routerCong, Topo.CLIENT_NAME + "Cong-eth0", "10.0.2.1", netmask)
self.configureInterface(self.routerCong, self.clientCong, Topo.ROUTER_NAME + "Cong-eth1", "10.0.2.2", netmask)
print(str(links[2]))
# Router - Server
self.configureInterface(self.server, self.router, Topo.serverName + "-eth0", "10.1.0.1", netmask)
self.configureInterface(self.router, self.server, Topo.routerName + "-eth2", "10.1.0.2", netmask)
self.configureInterface(self.server, self.router, Topo.SERVER_NAME + "-eth0", "10.1.0.1", netmask)
self.configureInterface(self.router, self.server, Topo.ROUTER_NAME + "-eth2", "10.1.0.2", netmask)
# Router - Server cong
self.configureInterface(self.serverCong, self.router, Topo.serverName + "Cong-eth0", "10.1.1.1", netmask)
self.configureInterface(self.router, self.serverCong, Topo.routerName + "-eth3", "10.1.1.2", netmask)
self.configureInterface(self.serverCong, self.router, Topo.SERVER_NAME + "Cong-eth0", "10.1.1.1", netmask)
self.configureInterface(self.router, self.serverCong, Topo.ROUTER_NAME + "-eth3", "10.1.1.2", netmask)
def getClientIP(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP
def getClientSubnet(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
clientSubnet = lSubnet + str(interfaceID) + ".0/24"
return clientSubnet
def getClientCongIP(self):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
clientIP = lSubnet + str(2) + ".1"
return clientIP
def getClientCongSubnet(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
clientSubnet = lSubnet + str(128) + ".0/24"
return clientSubnet
def getRouterIPSwitch(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LSUBNET)
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
routerIP = lSubnet + str(interfaceID) + ".2"
return routerIP
def getRouterIPServer(self):
rSubnet = self.param.get(TopoParameter.RSUBNET)
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
routerIP = rSubnet + "0.2"
return routerIP
def getServerIP(self):
rSubnet = self.param.get(TopoParameter.RSUBNET)
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
serverIP = rSubnet + "0.1"
return serverIP
@ -226,22 +226,22 @@ class TwoInterfaceCongestionConfig(TopoConfig):
return self.get_router_interface_to_switch(len(self.topo.switch))
def get_client_interface(self, interfaceID):
return Topo.clientName + "-eth" + str(interfaceID)
return Topo.CLIENT_NAME + "-eth" + str(interfaceID)
def get_router_interface_to_switch(self, interfaceID):
return Topo.routerName + "-eth" + str(interfaceID)
return Topo.ROUTER_NAME + "-eth" + str(interfaceID)
def getServerInterface(self):
return Topo.serverName + "-eth0"
def get_server_interface(self):
return Topo.SERVER_NAME + "-eth0"
def getMidLeftName(self, id):
return Topo.switchNamePrefix + str(id)
return Topo.SWITCH_NAME_PREFIX + str(id)
def getMidRightName(self, id):
if id == 2:
return Topo.routerName + "Cong"
return Topo.ROUTER_NAME + "Cong"
return Topo.routerName
return Topo.ROUTER_NAME
def getMidL2RInterface(self, id):
return self.getMidLeftName(id) + "-eth2"