nearly clean now

This commit is contained in:
Quentin De Coninck 2020-06-29 16:23:39 +02:00
parent 705079494f
commit eb14eb60f5
23 changed files with 97 additions and 134 deletions

View File

@ -360,8 +360,8 @@ class Experiment(object):
"rm {}".format(Experiment.PING_OUTPUT)) "rm {}".format(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.client_interface_count()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.ping_command(self.topo_config.getClientIP(i), cmd = self.ping_command(self.topo_config.get_client_ip(i),
self.topo_config.getServerIP(), n = count) self.topo_config.get_server_ip(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
def ping_command(self, from_ip, to_ip, n=5): def ping_command(self, from_ip, to_ip, n=5):

View File

@ -497,13 +497,6 @@ class TopoConfig(object):
for b in self.topo.bottleneck_links: for b in self.topo.bottleneck_links:
b.configure_changing_bottleneck() b.configure_changing_bottleneck()
def getMidLeftName(self, i):
"get Middle link, left box name"
pass
def getMidRightName(self, i):
pass
def configure_interfaces(self): def configure_interfaces(self):
""" """
Function to inherit to configure the interfaces of the topology Function to inherit to configure the interfaces of the topology

View File

@ -46,7 +46,7 @@ class AB(RandomFileExperiment):
def get_ab_client_cmd(self): def get_ab_client_cmd(self):
s = "{} -c {} -t {} http://{}/{} &> {}".format(AB.AB_BIN, self.concurrent_requests, s = "{} -c {} -t {} http://{}/{} &> {}".format(AB.AB_BIN, self.concurrent_requests,
self.time_limit, self.topo_config.getServerIP(), self.file, AB.CLIENT_LOG) self.time_limit, self.topo_config.get_server_ip(), self.file, AB.CLIENT_LOG)
print(s) print(s)
return s return s

View File

@ -56,7 +56,7 @@ class DITG(Experiment):
self.topo.command_to(self.topo_config.client, "rm " + DITG.DITG_TEMP_LOG) self.topo.command_to(self.topo_config.client, "rm " + DITG.DITG_TEMP_LOG)
def getClientCmd(self): def getClientCmd(self):
s = DITG.ITGSEND_BIN + " -a " + self.topo_config.getServerIP() + \ s = DITG.ITGSEND_BIN + " -a " + self.topo_config.get_server_ip() + \
" -T TCP -k " + self.kbytes + " -l " + DITG.DITG_TEMP_LOG " -T TCP -k " + self.kbytes + " -l " + DITG.DITG_TEMP_LOG
if self.constant_packet_size != "0": if self.constant_packet_size != "0":

View File

@ -55,14 +55,14 @@ class Epload(Experiment):
def getSubHostCmd(self): def getSubHostCmd(self):
s = "for f in `ls " + self.test_dir + "/*`; do " + \ s = "for f in `ls " + self.test_dir + "/*`; do " + \
" sed -i 's/@host@/" + self.topo_config.getServerIP() + "/' " + \ " sed -i 's/@host@/" + self.topo_config.get_server_ip() + "/' " + \
"$f; done" "$f; done"
print(s) print(s)
return s return s
def getSubBackHostCmd(self): def getSubBackHostCmd(self):
s = "for f in `ls " + self.test_dir + "/*`; do " + \ s = "for f in `ls " + self.test_dir + "/*`; do " + \
" sed -i 's/" + self.topo_config.getServerIP() + "/@host@/' " + \ " sed -i 's/" + self.topo_config.get_server_ip() + "/@host@/' " + \
"$f; done" "$f; done"
print(s) print(s)
return s return s

View File

@ -31,7 +31,7 @@ class HTTP(RandomFileExperiment):
def getHTTPClientCmd(self): def getHTTPClientCmd(self):
s = "(time {} http://{}/{} --no-check-certificate) &> {}".format(HTTP.WGET_BIN, s = "(time {} http://{}/{} --no-check-certificate) &> {}".format(HTTP.WGET_BIN,
self.topo_config.getServerIP(), self.file, HTTP.CLIENT_LOG) self.topo_config.get_server_ip(), self.file, HTTP.CLIENT_LOG)
print(s) print(s)
return s return s

View File

@ -31,7 +31,7 @@ class HTTPS(RandomFileExperiment):
return s return s
def getHTTPSClientCmd(self): def getHTTPSClientCmd(self):
s = "(time " + HTTPS.WGET_BIN + " https://" + self.topo_config.getServerIP() + \ s = "(time " + HTTPS.WGET_BIN + " https://" + self.topo_config.get_server_ip() + \
"/" + self.file + " --no-check-certificate) &>" + HTTPS.CLIENT_LOG "/" + self.file + " --no-check-certificate) &>" + HTTPS.CLIENT_LOG
print(s) print(s)
return s return s

View File

@ -31,8 +31,8 @@ class IPerf(Experiment):
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.client_interface_count()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.ping_command(self.topo_config.getClientIP(i), cmd = self.ping_command(self.topo_config.get_client_ip(i),
self.topo_config.getServerIP(), n = count) self.topo_config.get_server_ip(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
def ping_command(self, fromIP, toIP, n=5): def ping_command(self, fromIP, toIP, n=5):
@ -53,7 +53,7 @@ class IPerf(Experiment):
IPerf.SERVER_LOG) IPerf.SERVER_LOG)
def getClientCmd(self): def getClientCmd(self):
s = IPerf.IPERF_BIN + " -c " + self.topo_config.getServerIP() + \ s = IPerf.IPERF_BIN + " -c " + self.topo_config.get_server_ip() + \
" -t " + self.time + " -P " + self.parallel + " &>" + IPerf.IPERF_LOG " -t " + self.time + " -P " + self.parallel + " &>" + IPerf.IPERF_LOG
print(s) print(s)
return s return s

View File

@ -36,8 +36,8 @@ class Msg(Experiment):
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.client_interface_count()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.ping_command(self.topo_config.getClientIP(i), cmd = self.ping_command(self.topo_config.get_client_ip(i),
self.topo_config.getServerIP(), n = count) self.topo_config.get_server_ip(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
def ping_command(self, fromIP, toIP, n=5): def ping_command(self, fromIP, toIP, n=5):

View File

@ -71,7 +71,7 @@ class NC(Experiment):
def getNCClientCmd(self, id): def getNCClientCmd(self, id):
s = NC.NC_BIN + " " + \ s = NC.NC_BIN + " " + \
" -p " + self.ncClientPort[id] + " " + \ " -p " + self.ncClientPort[id] + " " + \
self.topo_config.getServerIP() + " " + \ self.topo_config.get_server_ip() + " " + \
self.ncServerPort + " " + \ self.ncServerPort + " " + \
"&>" + NC.CLIENT_NC_LOG + \ "&>" + NC.CLIENT_NC_LOG + \
"_" + str(id) + ".log" "_" + str(id) + ".log"

View File

@ -52,8 +52,8 @@ class NCPV(NC):
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.client_interface_count()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.ping_command(self.topo_config.getClientIP(i), cmd = self.ping_command(self.topo_config.get_client_ip(i),
self.topo_config.getServerIP(), n = count) self.topo_config.get_server_ip(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
def ping_command(self, fromIP, toIP, n=5): def ping_command(self, fromIP, toIP, n=5):
@ -129,7 +129,7 @@ class NCPV(NC):
" -q --rate-limit " + self.pvRateLimit + \ " -q --rate-limit " + self.pvRateLimit + \
" | " + NC.NC_BIN + " " + \ " | " + NC.NC_BIN + " " + \
" -p " + self.ncClientPort[id] + " " + \ " -p " + self.ncClientPort[id] + " " + \
self.topo_config.getServerIP() + " " + \ self.topo_config.get_server_ip() + " " + \
self.ncServerPort + " " + \ self.ncServerPort + " " + \
"&>" + NCPV.CLIENT_NC_LOG + \ "&>" + NCPV.CLIENT_NC_LOG + \
"_" + str(id) + ".log" "_" + str(id) + ".log"

View File

@ -36,8 +36,8 @@ class Netperf(Experiment):
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.client_interface_count()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.ping_command(self.topo_config.getClientIP(i), cmd = self.ping_command(self.topo_config.get_client_ip(i),
self.topo_config.getServerIP(), n = count) self.topo_config.get_server_ip(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
def ping_command(self, fromIP, toIP, n=5): def ping_command(self, fromIP, toIP, n=5):
@ -60,7 +60,7 @@ class Netperf(Experiment):
def get_client_cmd(self): def get_client_cmd(self):
s = "{} -H {} -l {} -t {} -- -r {} &> {}".format(Netperf.NETPERF_BIN, s = "{} -H {} -l {} -t {} -- -r {} &> {}".format(Netperf.NETPERF_BIN,
self.topo_config.getServerIP(), self.testlen, self.testname, self.reqres_size, self.topo_config.get_server_ip(), self.testlen, self.testname, self.reqres_size,
Netperf.NETPERF_LOG) Netperf.NETPERF_LOG)
print(s) print(s)
return s return s

View File

@ -19,8 +19,8 @@ class Ping(Experiment):
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.client_interface_count()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.ping_command(self.topo_config.getClientIP(i), cmd = self.ping_command(self.topo_config.get_client_ip(i),
self.topo_config.getServerIP(), n = count) self.topo_config.get_server_ip(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
def ping_command(self, fromIP, toIP, n=5): def ping_command(self, fromIP, toIP, n=5):

View File

@ -35,8 +35,8 @@ class QUIC(RandomFileExperiment):
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.client_interface_count()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.ping_command(self.topo_config.getClientIP(i), cmd = self.ping_command(self.topo_config.get_client_ip(i),
self.topo_config.getServerIP(), n = count) self.topo_config.get_server_ip(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
def ping_command(self, fromIP, toIP, n=5): def ping_command(self, fromIP, toIP, n=5):
@ -67,7 +67,7 @@ class QUIC(RandomFileExperiment):
s = QUIC.GO_BIN + " run " + QUIC.CLIENT_GO_FILE s = QUIC.GO_BIN + " run " + QUIC.CLIENT_GO_FILE
if int(self.multipath) > 0: if int(self.multipath) > 0:
s += " -m" s += " -m"
s += " https://" + self.topo_config.getServerIP() + ":6121/random &>" + QUIC.CLIENT_LOG s += " https://" + self.topo_config.get_server_ip() + ":6121/random &>" + QUIC.CLIENT_LOG
print(s) print(s)
return s return s

View File

@ -34,8 +34,8 @@ class QUICSiri(Experiment):
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.client_interface_count()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.ping_command(self.topo_config.getClientIP(i), cmd = self.ping_command(self.topo_config.get_client_ip(i),
self.topo_config.getServerIP(), n = count) self.topo_config.get_server_ip(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
def ping_command(self, fromIP, toIP, n=5): def ping_command(self, fromIP, toIP, n=5):
@ -63,7 +63,7 @@ class QUICSiri(Experiment):
def get_quic_siri_client_cmd(self): def get_quic_siri_client_cmd(self):
s = "{} run {} -addr {}:8080 -runTime {}s {} &> {}".format(QUICSiri.GO_BIN, s = "{} run {} -addr {}:8080 -runTime {}s {} &> {}".format(QUICSiri.GO_BIN,
QUICSiri.CLIENT_GO_FILE, self.topo_config.getServerIP(), self.run_time, QUICSiri.CLIENT_GO_FILE, self.topo_config.get_server_ip(), self.run_time,
"-m" if int(self.multipath) > 0 else "", QUICSiri.CLIENT_LOG) "-m" if int(self.multipath) > 0 else "", QUICSiri.CLIENT_LOG)
print(s) print(s)
return s return s

View File

@ -18,8 +18,8 @@ class SendFile(RandomFileExperiment):
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.client_interface_count()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.ping_command(self.topo_config.getClientIP(i), cmd = self.ping_command(self.topo_config.get_client_ip(i),
self.topo_config.getServerIP(), n = count) self.topo_config.get_server_ip(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
def ping_command(self, fromIP, toIP, n=5): def ping_command(self, fromIP, toIP, n=5):
@ -44,7 +44,7 @@ class SendFile(RandomFileExperiment):
return s return s
def getSendFileClientCmd(self): def getSendFileClientCmd(self):
s = SendFile.WGET_BIN + " " + self.topo_config.getServerIP() + " &>" + SendFile.CLIENT_LOG s = SendFile.WGET_BIN + " " + self.topo_config.get_server_ip() + " &>" + SendFile.CLIENT_LOG
print(s) print(s)
return s return s

View File

@ -49,8 +49,8 @@ class Siri(Experiment):
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.client_interface_count()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.ping_command(self.topo_config.getClientIP(i), cmd = self.ping_command(self.topo_config.get_client_ip(i),
self.topo_config.getServerIP(), n = count) self.topo_config.get_server_ip(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
def ping_command(self, fromIP, toIP, n=5): def ping_command(self, fromIP, toIP, n=5):
@ -86,7 +86,7 @@ class Siri(Experiment):
def get_siri_client_cmd(self): def get_siri_client_cmd(self):
s = "{} -jar {}/../utils/siriClient.jar {} 8080 {} {} {} {} {} {} {} {} {} {} > {} 2> {}".format( s = "{} -jar {}/../utils/siriClient.jar {} 8080 {} {} {} {} {} {} {} {} {} {} > {} 2> {}".format(
Siri.JAVA_BIN, os.path.dirname(os.path.abspath(__file__)), self.topo_config.getServerIP(), Siri.JAVA_BIN, os.path.dirname(os.path.abspath(__file__)), self.topo_config.get_server_ip(),
self.run_time, self.query_size, self.response_size, self.delay_query_response, self.run_time, self.query_size, self.response_size, self.delay_query_response,
self.min_payload_size, self.max_payload_size, self.interval_time_ms, self.buffer_size, self.min_payload_size, self.max_payload_size, self.interval_time_ms, self.buffer_size,
self.burst_size, self.interval_burst_time_ms, Siri.CLIENT_LOG, Siri.CLIENT_ERR) self.burst_size, self.interval_burst_time_ms, Siri.CLIENT_LOG, Siri.CLIENT_ERR)

View File

@ -23,8 +23,8 @@ class SiriHTTP(Siri, RandomFileExperiment):
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.client_interface_count()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.ping_command(self.topo_config.getClientIP(i), cmd = self.ping_command(self.topo_config.get_client_ip(i),
self.topo_config.getServerIP(), n = count) self.topo_config.get_server_ip(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
def ping_command(self, fromIP, toIP, n=5): def ping_command(self, fromIP, toIP, n=5):
@ -54,7 +54,7 @@ class SiriHTTP(Siri, RandomFileExperiment):
return s return s
def getHTTPClientCmd(self): def getHTTPClientCmd(self):
s = SiriHTTP.WGET_BIN + " http://" + self.topo_config.getServerIP() + \ s = SiriHTTP.WGET_BIN + " http://" + self.topo_config.get_server_ip() + \
"/" + self.file + " --no-check-certificate" "/" + self.file + " --no-check-certificate"
print(s) print(s)
return s return s

View File

@ -31,8 +31,8 @@ class VLC(Experiment):
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.client_interface_count()): for i in range(0, self.topo_config.client_interface_count()):
cmd = self.ping_command(self.topo_config.getClientIP(i), cmd = self.ping_command(self.topo_config.get_client_ip(i),
self.topo_config.getServerIP(), n = count) self.topo_config.get_server_ip(), n = count)
self.topo.command_to(self.topo_config.client, cmd) self.topo.command_to(self.topo_config.client, cmd)
def ping_command(self, fromIP, toIP, n=5): def ping_command(self, fromIP, toIP, n=5):
@ -62,7 +62,7 @@ class VLC(Experiment):
s = "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/mininet/usr/lib/ && sudo ldconfig && \ s = "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/mininet/usr/lib/ && sudo ldconfig && \
{} -I dummy --x11-display :66 --adaptive-logic 3 --no-loop --play-and-exit \ {} -I dummy --x11-display :66 --adaptive-logic 3 --no-loop --play-and-exit \
http://{}/{} 2>&1 | grep -E '(Neb|halp|bandwidth|late|Buffering|buffering)' > {} {}".format( http://{}/{} 2>&1 | grep -E '(Neb|halp|bandwidth|late|Buffering|buffering)' > {} {}".format(
VLC.VLC_BIN, self.topo_config.getServerIP(), self.file, VLC.CLIENT_LOG, VLC.VLC_BIN, self.topo_config.get_server_ip(), self.file, VLC.CLIENT_LOG,
"&" if self.time != "0" else "") "&" if self.time != "0" else "")
print(s) print(s)
return s return s

View File

@ -152,14 +152,14 @@ class ECMPSingleInterfaceConfig(TopoConfig):
i = i + 1 i = i + 1
cmd = self.interface_up_command(self.get_client_interface(0), cmd = self.interface_up_command(self.get_client_interface(0),
self.getClientIP(0), netmask) self.get_client_ip(0), netmask)
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
cmd = self.interface_up_command(self.get_server_interface(), cmd = self.interface_up_command(self.get_server_interface(),
self.getServerIP(), netmask) self.get_server_ip(), netmask)
self.topo.command_to(self.server, cmd) self.topo.command_to(self.server, cmd)
def getClientIP(self, interfaceID): def get_client_ip(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET) lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
clientIP = lSubnet + str(interfaceID) + ".1" clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP return clientIP
@ -179,7 +179,7 @@ class ECMPSingleInterfaceConfig(TopoConfig):
routerIP = rSubnet + "0." + str(id + 2) routerIP = rSubnet + "0." + str(id + 2)
return routerIP return routerIP
def getServerIP(self): def get_server_ip(self):
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET) rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
serverIP = rSubnet + "0.1" serverIP = rSubnet + "0.1"
return serverIP return serverIP

View File

@ -1,32 +1,31 @@
from core.topo import Topo, TopoConfig, TopoParameter from core.topo import Topo, TopoConfig, TopoParameter
import logging
class MultiInterfaceTopo(Topo): class MultiInterfaceTopo(Topo):
NAME = "MultiIf" NAME = "MultiIf"
def __init__(self, topo_builder, parameterFile): def __init__(self, topo_builder, parameterFile):
logging.info("Initializing MultiInterfaceTopo...")
super(MultiInterfaceTopo, self).__init__(topo_builder, parameterFile) super(MultiInterfaceTopo, self).__init__(topo_builder, parameterFile)
print("Hello from topo multi if")
self.client = self.add_client() self.client = self.add_client()
self.server = self.add_server() self.server = self.add_server()
self.router = self.add_router() self.router = self.add_router()
print(self.router) self.client_switches = []
self.switchClient = [] self.server_switches = []
self.switchServer = []
for l in self.topo_parameter.link_characteristics: for l in self.topo_parameter.link_characteristics:
self.switchClient.append(self.add_switch1ForLink(l)) self.client_switches.append(self.add_client_side_switch(l))
self.add_link(self.client,self.switchClient[-1]) self.add_link(self.client,self.client_switches[-1])
self.switchServer.append(self.add_switch2ForLink(l)) self.server_switches.append(self.add_router_side_switch(l))
self.add_bottleneck_link(self.switchClient[-1], self.switchServer[-1], link_characteristics=l) self.add_bottleneck_link(self.client_switches[-1], self.server_switches[-1], link_characteristics=l)
self.add_link(self.switchServer[-1],self.router) self.add_link(self.server_switches[-1],self.router)
self.add_link(self.router, self.server) self.add_link(self.router, self.server)
def add_switch1ForLink(self, link): def add_client_side_switch(self, link):
return self.add_switch(MultiInterfaceTopo.SWITCH_NAME_PREFIX + return self.add_switch("{}{}".format(MultiInterfaceTopo.SWITCH_NAME_PREFIX, 2 * link.id))
str(2 * link.id))
def add_switch2ForLink(self, link): def add_router_side_switch(self, link):
return self.add_switch(MultiInterfaceTopo.SWITCH_NAME_PREFIX + return self.add_switch("{}{}".format(MultiInterfaceTopo.SWITCH_NAME_PREFIX, 2 * link.id + 1))
str(2 * link.id + 1))
def __str__(self): def __str__(self):
s = "Simple multiple interface topolgy \n" s = "Simple multiple interface topolgy \n"
@ -53,31 +52,31 @@ class MultiInterfaceConfig(TopoConfig):
def configure_routing(self): def configure_routing(self):
i = 0 i = 0
for l in self.topo.switchClient: for l in self.topo.client_switches:
cmd = self.add_table_route_command(self.getClientIP(i), i) cmd = self.add_table_route_command(self.get_client_ip(i), i)
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
cmd = self.add_link_scope_route_command( cmd = self.add_link_scope_route_command(
self.getClientSubnet(i), self.get_client_subnet(i),
self.get_client_interface(0, i), i) self.get_client_interface(0, i), i)
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
cmd = self.add_table_default_route_command(self.getRouterIPSwitch(i), cmd = self.add_table_default_route_command(self.get_router_ip_to_switch(i),
i) i)
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
i = i + 1 i = i + 1
cmd = self.add_global_default_route_command(self.getRouterIPSwitch(0), cmd = self.add_global_default_route_command(self.get_router_ip_to_switch(0),
self.get_client_interface(0, 0)) self.get_client_interface(0, 0))
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
cmd = self.add_simple_default_route_command(self.getRouterIPServer()) cmd = self.add_simple_default_route_command(self.get_router_ip_to_server())
self.topo.command_to(self.server, cmd) self.topo.command_to(self.server, cmd)
def configure_interfaces(self): def configure_interfaces(self):
logging.info("Configure interfaces using MultiInterfaceConfig...")
super(MultiInterfaceConfig, self).configure_interfaces() super(MultiInterfaceConfig, self).configure_interfaces()
print("Configure interfaces for multi inf")
self.client = self.topo.get_client(0) self.client = self.topo.get_client(0)
self.server = self.topo.get_server(0) self.server = self.topo.get_server(0)
self.router = self.topo.get_router(0) self.router = self.topo.get_router(0)
@ -85,13 +84,13 @@ class MultiInterfaceConfig(TopoConfig):
netmask = "255.255.255.0" netmask = "255.255.255.0"
links = self.topo.get_link_characteristics() links = self.topo.get_link_characteristics()
for l in self.topo.switchClient: for l in self.topo.client_switches:
cmd = self.interface_up_command( cmd = self.interface_up_command(
self.get_client_interface(0, i), self.get_client_interface(0, i),
self.getClientIP(i), netmask) self.get_client_ip(i), netmask)
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
clientIntfMac = self.client.intf(self.get_client_interface(0, i)).MAC() clientIntfMac = self.client.intf(self.get_client_interface(0, i)).MAC()
self.topo.command_to(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac) self.topo.command_to(self.router, "arp -s " + self.get_client_ip(i) + " " + clientIntfMac)
if(links[i].backup): if(links[i].backup):
cmd = self.interface_backup_command( cmd = self.interface_backup_command(
@ -101,58 +100,47 @@ class MultiInterfaceConfig(TopoConfig):
i = i + 1 i = i + 1
i = 0 i = 0
for l in self.topo.switchServer: for l in self.topo.server_switches:
cmd = self.interface_up_command( cmd = self.interface_up_command(
self.get_router_interface_to_switch(i), self.get_router_interface_to_switch(i),
self.getRouterIPSwitch(i), netmask) self.get_router_ip_to_switch(i), netmask)
self.topo.command_to(self.router, cmd) self.topo.command_to(self.router, cmd)
routerIntfMac = self.router.intf(self.get_router_interface_to_switch(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.get_router_ip_to_switch(i) + " " + routerIntfMac)
print(str(links[i]))
i = i + 1 i = i + 1
cmd = self.interface_up_command(self.getRouterInterfaceServer(), cmd = self.interface_up_command(self.getRouterInterfaceServer(),
self.getRouterIPServer(), netmask) self.get_router_ip_to_server(), netmask)
self.topo.command_to(self.router, cmd) self.topo.command_to(self.router, cmd)
routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC() routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC()
self.topo.command_to(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac) self.topo.command_to(self.server, "arp -s " + self.get_router_ip_to_server() + " " + routerIntfMac)
cmd = self.interface_up_command(self.get_server_interface(0), cmd = self.interface_up_command(self.get_server_interface(0),
self.getServerIP(), netmask) self.get_server_ip(), netmask)
self.topo.command_to(self.server, cmd) self.topo.command_to(self.server, cmd)
serverIntfMac = self.server.intf(self.get_server_interface(0)).MAC() serverIntfMac = self.server.intf(self.get_server_interface(0)).MAC()
self.topo.command_to(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac) self.topo.command_to(self.router, "arp -s " + self.get_server_ip() + " " + serverIntfMac)
def getClientIP(self, interfaceID): def get_client_ip(self, interface_index):
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET) return "{}{}.1".format(self.param.get(TopoParameter.LEFT_SUBNET), interface_index)
clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP
def getClientSubnet(self, interfaceID): def get_client_subnet(self, interface_index):
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET) return "{}{}.0/24".format(self.param.get(TopoParameter.LEFT_SUBNET), interface_index)
clientSubnet = lSubnet + str(interfaceID) + ".0/24"
return clientSubnet
def getRouterIPSwitch(self, interfaceID): def get_router_ip_to_switch(self, switch_index):
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET) return "{}{}.2".format(self.param.get(TopoParameter.LEFT_SUBNET), switch_index)
routerIP = lSubnet + str(interfaceID) + ".2"
return routerIP
def getRouterIPServer(self): def get_router_ip_to_server(self):
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET) return "{}0.2".format(self.param.get(TopoParameter.RIGHT_SUBNET))
routerIP = rSubnet + "0.2"
return routerIP
def getServerIP(self): def get_server_ip(self):
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET) return "{}0.1".format(self.param.get(TopoParameter.RIGHT_SUBNET))
serverIP = rSubnet + "0.1"
return serverIP
def client_interface_count(self): def client_interface_count(self):
return len(self.topo.switchClient) return len(self.topo.client_switches)
def getRouterInterfaceServer(self): def getRouterInterfaceServer(self):
return self.get_router_interface_to_switch(len(self.topo.switchServer)) return self.get_router_interface_to_switch(len(self.topo.server_switches))
def get_client_interface(self, client_index, interface_index): def get_client_interface(self, client_index, interface_index):
return "{}-eth{}".format(self.topo.get_client_name(client_index), interface_index) return "{}-eth{}".format(self.topo.get_client_name(client_index), interface_index)
@ -161,22 +149,4 @@ class MultiInterfaceConfig(TopoConfig):
return "{}-eth{}".format(self.topo.get_router_name(0), interface_index) return "{}-eth{}".format(self.topo.get_router_name(0), interface_index)
def get_server_interface(self, server_index): def get_server_interface(self, server_index):
return "{}-eth0".format(self.topo.get_server_name(server_index)) return "{}-eth0".format(self.topo.get_server_name(server_index))
def getSwitchClientName(self, id):
return Topo.SWITCH_NAME_PREFIX + str(2 * id)
def getSwitchServerName(self, id):
return Topo.SWITCH_NAME_PREFIX + str(2 * id + 1)
def getMidLeftName(self, id):
return self.getSwitchClientName(id)
def getMidRightName(self, id):
return self.getSwitchServerName(id)
def getMidL2RIncomingInterface(self, id):
return self.getMidLeftName(id) + "-eth1"
def getMidR2LIncomingInterface(self, id):
return self.getMidRightName(id) + "-eth2"

View File

@ -65,7 +65,7 @@ class MultiInterfaceCongConfig(TopoConfig):
def configure_routing(self): def configure_routing(self):
i = 0 i = 0
for l in self.topo.switch: for l in self.topo.switch:
cmd = self.add_table_route_command(self.getClientIP(i), i) cmd = self.add_table_route_command(self.get_client_ip(i), i)
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
# Congestion client # Congestion client
@ -139,10 +139,10 @@ class MultiInterfaceCongConfig(TopoConfig):
for l in self.topo.switch: for l in self.topo.switch:
cmd = self.interface_up_command( cmd = self.interface_up_command(
self.get_client_interface(i), self.get_client_interface(i),
self.getClientIP(i), netmask) self.get_client_ip(i), netmask)
self.topo.command_to(self.client, cmd) self.topo.command_to(self.client, cmd)
clientIntfMac = self.client.intf(self.get_client_interface(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.get_client_ip(i) + " " + clientIntfMac)
if(links[i].backup): if(links[i].backup):
cmd = self.interface_backup_command( cmd = self.interface_backup_command(
@ -175,10 +175,10 @@ class MultiInterfaceCongConfig(TopoConfig):
self.topo.command_to(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac) self.topo.command_to(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac)
cmd = self.interface_up_command(self.get_server_interface(), cmd = self.interface_up_command(self.get_server_interface(),
self.getServerIP(), netmask) self.get_server_ip(), netmask)
self.topo.command_to(self.server, cmd) self.topo.command_to(self.server, cmd)
serverIntfMac = self.server.intf(self.get_server_interface()).MAC() serverIntfMac = self.server.intf(self.get_server_interface()).MAC()
self.topo.command_to(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac) self.topo.command_to(self.router, "arp -s " + self.get_server_ip() + " " + serverIntfMac)
# Congestion servers # Congestion servers
i = 0 i = 0
@ -196,7 +196,7 @@ class MultiInterfaceCongConfig(TopoConfig):
self.topo.command_to(self.router, "arp -s " + self.getCongServerIP(i) + " " + congServerIntfMac) self.topo.command_to(self.router, "arp -s " + self.getCongServerIP(i) + " " + congServerIntfMac)
i = i + 1 i = i + 1
def getClientIP(self, interfaceID): def get_client_ip(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET) lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
clientIP = lSubnet + str(interfaceID) + ".1" clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP return clientIP
@ -226,7 +226,7 @@ class MultiInterfaceCongConfig(TopoConfig):
routerIP = rSubnet + str(1 + congID) + ".2" routerIP = rSubnet + str(1 + congID) + ".2"
return routerIP return routerIP
def getServerIP(self): def get_server_ip(self):
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET) rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
serverIP = rSubnet + "0.1" serverIP = rSubnet + "0.1"
return serverIP return serverIP

View File

@ -185,7 +185,7 @@ class TwoInterfaceCongestionConfig(TopoConfig):
self.configureInterface(self.serverCong, self.router, Topo.SERVER_NAME + "Cong-eth0", "10.1.1.1", 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) self.configureInterface(self.router, self.serverCong, Topo.ROUTER_NAME + "-eth3", "10.1.1.2", netmask)
def getClientIP(self, interfaceID): def get_client_ip(self, interfaceID):
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET) lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
clientIP = lSubnet + str(interfaceID) + ".1" clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP return clientIP
@ -215,7 +215,7 @@ class TwoInterfaceCongestionConfig(TopoConfig):
routerIP = rSubnet + "0.2" routerIP = rSubnet + "0.2"
return routerIP return routerIP
def getServerIP(self): def get_server_ip(self):
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET) rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
serverIP = rSubnet + "0.1" serverIP = rSubnet + "0.1"
return serverIP return serverIP