nearly clean now
This commit is contained in:
parent
705079494f
commit
eb14eb60f5
@ -360,8 +360,8 @@ class Experiment(object):
|
||||
"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)
|
||||
cmd = self.ping_command(self.topo_config.get_client_ip(i),
|
||||
self.topo_config.get_server_ip(), n = count)
|
||||
self.topo.command_to(self.topo_config.client, cmd)
|
||||
|
||||
def ping_command(self, from_ip, to_ip, n=5):
|
||||
|
@ -497,13 +497,6 @@ class TopoConfig(object):
|
||||
for b in self.topo.bottleneck_links:
|
||||
b.configure_changing_bottleneck()
|
||||
|
||||
def getMidLeftName(self, i):
|
||||
"get Middle link, left box name"
|
||||
pass
|
||||
|
||||
def getMidRightName(self, i):
|
||||
pass
|
||||
|
||||
def configure_interfaces(self):
|
||||
"""
|
||||
Function to inherit to configure the interfaces of the topology
|
||||
|
@ -46,7 +46,7 @@ class AB(RandomFileExperiment):
|
||||
|
||||
def get_ab_client_cmd(self):
|
||||
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)
|
||||
return s
|
||||
|
||||
|
@ -56,7 +56,7 @@ class DITG(Experiment):
|
||||
self.topo.command_to(self.topo_config.client, "rm " + DITG.DITG_TEMP_LOG)
|
||||
|
||||
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
|
||||
|
||||
if self.constant_packet_size != "0":
|
||||
|
@ -55,14 +55,14 @@ class Epload(Experiment):
|
||||
|
||||
def getSubHostCmd(self):
|
||||
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"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getSubBackHostCmd(self):
|
||||
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"
|
||||
print(s)
|
||||
return s
|
||||
|
@ -31,7 +31,7 @@ class HTTP(RandomFileExperiment):
|
||||
|
||||
def getHTTPClientCmd(self):
|
||||
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)
|
||||
return s
|
||||
|
||||
|
@ -31,7 +31,7 @@ class HTTPS(RandomFileExperiment):
|
||||
return s
|
||||
|
||||
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
|
||||
print(s)
|
||||
return s
|
||||
|
@ -31,8 +31,8 @@ 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.ping_command(self.topo_config.getClientIP(i),
|
||||
self.topo_config.getServerIP(), n = count)
|
||||
cmd = self.ping_command(self.topo_config.get_client_ip(i),
|
||||
self.topo_config.get_server_ip(), n = count)
|
||||
self.topo.command_to(self.topo_config.client, cmd)
|
||||
|
||||
def ping_command(self, fromIP, toIP, n=5):
|
||||
@ -53,7 +53,7 @@ class IPerf(Experiment):
|
||||
IPerf.SERVER_LOG)
|
||||
|
||||
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
|
||||
print(s)
|
||||
return s
|
||||
|
@ -36,8 +36,8 @@ 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.ping_command(self.topo_config.getClientIP(i),
|
||||
self.topo_config.getServerIP(), n = count)
|
||||
cmd = self.ping_command(self.topo_config.get_client_ip(i),
|
||||
self.topo_config.get_server_ip(), n = count)
|
||||
self.topo.command_to(self.topo_config.client, cmd)
|
||||
|
||||
def ping_command(self, fromIP, toIP, n=5):
|
||||
|
@ -71,7 +71,7 @@ class NC(Experiment):
|
||||
def getNCClientCmd(self, id):
|
||||
s = NC.NC_BIN + " " + \
|
||||
" -p " + self.ncClientPort[id] + " " + \
|
||||
self.topo_config.getServerIP() + " " + \
|
||||
self.topo_config.get_server_ip() + " " + \
|
||||
self.ncServerPort + " " + \
|
||||
"&>" + NC.CLIENT_NC_LOG + \
|
||||
"_" + str(id) + ".log"
|
||||
|
@ -52,8 +52,8 @@ 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.ping_command(self.topo_config.getClientIP(i),
|
||||
self.topo_config.getServerIP(), n = count)
|
||||
cmd = self.ping_command(self.topo_config.get_client_ip(i),
|
||||
self.topo_config.get_server_ip(), n = count)
|
||||
self.topo.command_to(self.topo_config.client, cmd)
|
||||
|
||||
def ping_command(self, fromIP, toIP, n=5):
|
||||
@ -129,7 +129,7 @@ class NCPV(NC):
|
||||
" -q --rate-limit " + self.pvRateLimit + \
|
||||
" | " + NC.NC_BIN + " " + \
|
||||
" -p " + self.ncClientPort[id] + " " + \
|
||||
self.topo_config.getServerIP() + " " + \
|
||||
self.topo_config.get_server_ip() + " " + \
|
||||
self.ncServerPort + " " + \
|
||||
"&>" + NCPV.CLIENT_NC_LOG + \
|
||||
"_" + str(id) + ".log"
|
||||
|
@ -36,8 +36,8 @@ 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.ping_command(self.topo_config.getClientIP(i),
|
||||
self.topo_config.getServerIP(), n = count)
|
||||
cmd = self.ping_command(self.topo_config.get_client_ip(i),
|
||||
self.topo_config.get_server_ip(), n = count)
|
||||
self.topo.command_to(self.topo_config.client, cmd)
|
||||
|
||||
def ping_command(self, fromIP, toIP, n=5):
|
||||
@ -60,7 +60,7 @@ class Netperf(Experiment):
|
||||
|
||||
def get_client_cmd(self):
|
||||
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)
|
||||
print(s)
|
||||
return s
|
||||
|
@ -19,8 +19,8 @@ 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.ping_command(self.topo_config.getClientIP(i),
|
||||
self.topo_config.getServerIP(), n = count)
|
||||
cmd = self.ping_command(self.topo_config.get_client_ip(i),
|
||||
self.topo_config.get_server_ip(), n = count)
|
||||
self.topo.command_to(self.topo_config.client, cmd)
|
||||
|
||||
def ping_command(self, fromIP, toIP, n=5):
|
||||
|
@ -35,8 +35,8 @@ 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.ping_command(self.topo_config.getClientIP(i),
|
||||
self.topo_config.getServerIP(), n = count)
|
||||
cmd = self.ping_command(self.topo_config.get_client_ip(i),
|
||||
self.topo_config.get_server_ip(), n = count)
|
||||
self.topo.command_to(self.topo_config.client, cmd)
|
||||
|
||||
def ping_command(self, fromIP, toIP, n=5):
|
||||
@ -67,7 +67,7 @@ class QUIC(RandomFileExperiment):
|
||||
s = QUIC.GO_BIN + " run " + QUIC.CLIENT_GO_FILE
|
||||
if int(self.multipath) > 0:
|
||||
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)
|
||||
return s
|
||||
|
||||
|
@ -34,8 +34,8 @@ 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.ping_command(self.topo_config.getClientIP(i),
|
||||
self.topo_config.getServerIP(), n = count)
|
||||
cmd = self.ping_command(self.topo_config.get_client_ip(i),
|
||||
self.topo_config.get_server_ip(), n = count)
|
||||
self.topo.command_to(self.topo_config.client, cmd)
|
||||
|
||||
def ping_command(self, fromIP, toIP, n=5):
|
||||
@ -63,7 +63,7 @@ class QUICSiri(Experiment):
|
||||
|
||||
def get_quic_siri_client_cmd(self):
|
||||
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)
|
||||
print(s)
|
||||
return s
|
||||
|
@ -18,8 +18,8 @@ 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.ping_command(self.topo_config.getClientIP(i),
|
||||
self.topo_config.getServerIP(), n = count)
|
||||
cmd = self.ping_command(self.topo_config.get_client_ip(i),
|
||||
self.topo_config.get_server_ip(), n = count)
|
||||
self.topo.command_to(self.topo_config.client, cmd)
|
||||
|
||||
def ping_command(self, fromIP, toIP, n=5):
|
||||
@ -44,7 +44,7 @@ class SendFile(RandomFileExperiment):
|
||||
return s
|
||||
|
||||
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)
|
||||
return s
|
||||
|
||||
|
@ -49,8 +49,8 @@ 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.ping_command(self.topo_config.getClientIP(i),
|
||||
self.topo_config.getServerIP(), n = count)
|
||||
cmd = self.ping_command(self.topo_config.get_client_ip(i),
|
||||
self.topo_config.get_server_ip(), n = count)
|
||||
self.topo.command_to(self.topo_config.client, cmd)
|
||||
|
||||
def ping_command(self, fromIP, toIP, n=5):
|
||||
@ -86,7 +86,7 @@ class Siri(Experiment):
|
||||
|
||||
def get_siri_client_cmd(self):
|
||||
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.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)
|
||||
|
@ -23,8 +23,8 @@ 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.ping_command(self.topo_config.getClientIP(i),
|
||||
self.topo_config.getServerIP(), n = count)
|
||||
cmd = self.ping_command(self.topo_config.get_client_ip(i),
|
||||
self.topo_config.get_server_ip(), n = count)
|
||||
self.topo.command_to(self.topo_config.client, cmd)
|
||||
|
||||
def ping_command(self, fromIP, toIP, n=5):
|
||||
@ -54,7 +54,7 @@ class SiriHTTP(Siri, RandomFileExperiment):
|
||||
return s
|
||||
|
||||
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"
|
||||
print(s)
|
||||
return s
|
||||
|
@ -31,8 +31,8 @@ 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.ping_command(self.topo_config.getClientIP(i),
|
||||
self.topo_config.getServerIP(), n = count)
|
||||
cmd = self.ping_command(self.topo_config.get_client_ip(i),
|
||||
self.topo_config.get_server_ip(), n = count)
|
||||
self.topo.command_to(self.topo_config.client, cmd)
|
||||
|
||||
def ping_command(self, fromIP, toIP, n=5):
|
||||
@ -62,7 +62,7 @@ class VLC(Experiment):
|
||||
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 \
|
||||
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 "")
|
||||
print(s)
|
||||
return s
|
||||
|
@ -152,14 +152,14 @@ class ECMPSingleInterfaceConfig(TopoConfig):
|
||||
i = i + 1
|
||||
|
||||
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)
|
||||
|
||||
cmd = self.interface_up_command(self.get_server_interface(),
|
||||
self.getServerIP(), netmask)
|
||||
self.get_server_ip(), netmask)
|
||||
self.topo.command_to(self.server, cmd)
|
||||
|
||||
def getClientIP(self, interfaceID):
|
||||
def get_client_ip(self, interfaceID):
|
||||
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
|
||||
clientIP = lSubnet + str(interfaceID) + ".1"
|
||||
return clientIP
|
||||
@ -179,7 +179,7 @@ class ECMPSingleInterfaceConfig(TopoConfig):
|
||||
routerIP = rSubnet + "0." + str(id + 2)
|
||||
return routerIP
|
||||
|
||||
def getServerIP(self):
|
||||
def get_server_ip(self):
|
||||
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
|
||||
serverIP = rSubnet + "0.1"
|
||||
return serverIP
|
||||
|
@ -1,32 +1,31 @@
|
||||
from core.topo import Topo, TopoConfig, TopoParameter
|
||||
import logging
|
||||
|
||||
|
||||
class MultiInterfaceTopo(Topo):
|
||||
NAME = "MultiIf"
|
||||
|
||||
def __init__(self, topo_builder, parameterFile):
|
||||
logging.info("Initializing MultiInterfaceTopo...")
|
||||
super(MultiInterfaceTopo, self).__init__(topo_builder, parameterFile)
|
||||
print("Hello from topo multi if")
|
||||
self.client = self.add_client()
|
||||
self.server = self.add_server()
|
||||
self.router = self.add_router()
|
||||
print(self.router)
|
||||
self.switchClient = []
|
||||
self.switchServer = []
|
||||
self.client_switches = []
|
||||
self.server_switches = []
|
||||
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_bottleneck_link(self.switchClient[-1], self.switchServer[-1], link_characteristics=l)
|
||||
self.add_link(self.switchServer[-1],self.router)
|
||||
self.client_switches.append(self.add_client_side_switch(l))
|
||||
self.add_link(self.client,self.client_switches[-1])
|
||||
self.server_switches.append(self.add_router_side_switch(l))
|
||||
self.add_bottleneck_link(self.client_switches[-1], self.server_switches[-1], link_characteristics=l)
|
||||
self.add_link(self.server_switches[-1],self.router)
|
||||
self.add_link(self.router, self.server)
|
||||
|
||||
def add_switch1ForLink(self, link):
|
||||
return self.add_switch(MultiInterfaceTopo.SWITCH_NAME_PREFIX +
|
||||
str(2 * link.id))
|
||||
def add_client_side_switch(self, link):
|
||||
return self.add_switch("{}{}".format(MultiInterfaceTopo.SWITCH_NAME_PREFIX, 2 * link.id))
|
||||
|
||||
def add_switch2ForLink(self, link):
|
||||
return self.add_switch(MultiInterfaceTopo.SWITCH_NAME_PREFIX +
|
||||
str(2 * link.id + 1))
|
||||
def add_router_side_switch(self, link):
|
||||
return self.add_switch("{}{}".format(MultiInterfaceTopo.SWITCH_NAME_PREFIX, 2 * link.id + 1))
|
||||
|
||||
def __str__(self):
|
||||
s = "Simple multiple interface topolgy \n"
|
||||
@ -53,31 +52,31 @@ class MultiInterfaceConfig(TopoConfig):
|
||||
|
||||
def configure_routing(self):
|
||||
i = 0
|
||||
for l in self.topo.switchClient:
|
||||
cmd = self.add_table_route_command(self.getClientIP(i), i)
|
||||
for l in self.topo.client_switches:
|
||||
cmd = self.add_table_route_command(self.get_client_ip(i), i)
|
||||
self.topo.command_to(self.client, cmd)
|
||||
|
||||
cmd = self.add_link_scope_route_command(
|
||||
self.getClientSubnet(i),
|
||||
self.get_client_subnet(i),
|
||||
self.get_client_interface(0, i), i)
|
||||
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)
|
||||
self.topo.command_to(self.client, cmd)
|
||||
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.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)
|
||||
|
||||
|
||||
def configure_interfaces(self):
|
||||
logging.info("Configure interfaces using MultiInterfaceConfig...")
|
||||
super(MultiInterfaceConfig, self).configure_interfaces()
|
||||
print("Configure interfaces for multi inf")
|
||||
self.client = self.topo.get_client(0)
|
||||
self.server = self.topo.get_server(0)
|
||||
self.router = self.topo.get_router(0)
|
||||
@ -85,13 +84,13 @@ class MultiInterfaceConfig(TopoConfig):
|
||||
netmask = "255.255.255.0"
|
||||
|
||||
links = self.topo.get_link_characteristics()
|
||||
for l in self.topo.switchClient:
|
||||
for l in self.topo.client_switches:
|
||||
cmd = self.interface_up_command(
|
||||
self.get_client_interface(0, i),
|
||||
self.getClientIP(i), netmask)
|
||||
self.get_client_ip(i), netmask)
|
||||
self.topo.command_to(self.client, cmd)
|
||||
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):
|
||||
cmd = self.interface_backup_command(
|
||||
@ -101,58 +100,47 @@ class MultiInterfaceConfig(TopoConfig):
|
||||
i = i + 1
|
||||
|
||||
i = 0
|
||||
for l in self.topo.switchServer:
|
||||
for l in self.topo.server_switches:
|
||||
cmd = self.interface_up_command(
|
||||
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)
|
||||
routerIntfMac = self.router.intf(self.get_router_interface_to_switch(i)).MAC()
|
||||
self.topo.command_to(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac)
|
||||
print(str(links[i]))
|
||||
self.topo.command_to(self.client, "arp -s " + self.get_router_ip_to_switch(i) + " " + routerIntfMac)
|
||||
i = i + 1
|
||||
|
||||
cmd = self.interface_up_command(self.getRouterInterfaceServer(),
|
||||
self.getRouterIPServer(), netmask)
|
||||
self.get_router_ip_to_server(), 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)
|
||||
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),
|
||||
self.getServerIP(), netmask)
|
||||
self.get_server_ip(), netmask)
|
||||
self.topo.command_to(self.server, cmd)
|
||||
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):
|
||||
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
|
||||
clientIP = lSubnet + str(interfaceID) + ".1"
|
||||
return clientIP
|
||||
def get_client_ip(self, interface_index):
|
||||
return "{}{}.1".format(self.param.get(TopoParameter.LEFT_SUBNET), interface_index)
|
||||
|
||||
def getClientSubnet(self, interfaceID):
|
||||
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
|
||||
clientSubnet = lSubnet + str(interfaceID) + ".0/24"
|
||||
return clientSubnet
|
||||
def get_client_subnet(self, interface_index):
|
||||
return "{}{}.0/24".format(self.param.get(TopoParameter.LEFT_SUBNET), interface_index)
|
||||
|
||||
def getRouterIPSwitch(self, interfaceID):
|
||||
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
|
||||
routerIP = lSubnet + str(interfaceID) + ".2"
|
||||
return routerIP
|
||||
def get_router_ip_to_switch(self, switch_index):
|
||||
return "{}{}.2".format(self.param.get(TopoParameter.LEFT_SUBNET), switch_index)
|
||||
|
||||
def getRouterIPServer(self):
|
||||
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
|
||||
routerIP = rSubnet + "0.2"
|
||||
return routerIP
|
||||
def get_router_ip_to_server(self):
|
||||
return "{}0.2".format(self.param.get(TopoParameter.RIGHT_SUBNET))
|
||||
|
||||
def getServerIP(self):
|
||||
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
|
||||
serverIP = rSubnet + "0.1"
|
||||
return serverIP
|
||||
def get_server_ip(self):
|
||||
return "{}0.1".format(self.param.get(TopoParameter.RIGHT_SUBNET))
|
||||
|
||||
def client_interface_count(self):
|
||||
return len(self.topo.switchClient)
|
||||
return len(self.topo.client_switches)
|
||||
|
||||
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):
|
||||
return "{}-eth{}".format(self.topo.get_client_name(client_index), interface_index)
|
||||
@ -162,21 +150,3 @@ class MultiInterfaceConfig(TopoConfig):
|
||||
|
||||
def get_server_interface(self, 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"
|
||||
|
@ -65,7 +65,7 @@ class MultiInterfaceCongConfig(TopoConfig):
|
||||
def configure_routing(self):
|
||||
i = 0
|
||||
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)
|
||||
|
||||
# Congestion client
|
||||
@ -139,10 +139,10 @@ class MultiInterfaceCongConfig(TopoConfig):
|
||||
for l in self.topo.switch:
|
||||
cmd = self.interface_up_command(
|
||||
self.get_client_interface(i),
|
||||
self.getClientIP(i), netmask)
|
||||
self.get_client_ip(i), netmask)
|
||||
self.topo.command_to(self.client, cmd)
|
||||
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):
|
||||
cmd = self.interface_backup_command(
|
||||
@ -175,10 +175,10 @@ class MultiInterfaceCongConfig(TopoConfig):
|
||||
self.topo.command_to(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac)
|
||||
|
||||
cmd = self.interface_up_command(self.get_server_interface(),
|
||||
self.getServerIP(), netmask)
|
||||
self.get_server_ip(), netmask)
|
||||
self.topo.command_to(self.server, cmd)
|
||||
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
|
||||
i = 0
|
||||
@ -196,7 +196,7 @@ class MultiInterfaceCongConfig(TopoConfig):
|
||||
self.topo.command_to(self.router, "arp -s " + self.getCongServerIP(i) + " " + congServerIntfMac)
|
||||
i = i + 1
|
||||
|
||||
def getClientIP(self, interfaceID):
|
||||
def get_client_ip(self, interfaceID):
|
||||
lSubnet = self.param.get(TopoParameter.LEFT_SUBNET)
|
||||
clientIP = lSubnet + str(interfaceID) + ".1"
|
||||
return clientIP
|
||||
@ -226,7 +226,7 @@ class MultiInterfaceCongConfig(TopoConfig):
|
||||
routerIP = rSubnet + str(1 + congID) + ".2"
|
||||
return routerIP
|
||||
|
||||
def getServerIP(self):
|
||||
def get_server_ip(self):
|
||||
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
|
||||
serverIP = rSubnet + "0.1"
|
||||
return serverIP
|
||||
|
@ -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.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)
|
||||
clientIP = lSubnet + str(interfaceID) + ".1"
|
||||
return clientIP
|
||||
@ -215,7 +215,7 @@ class TwoInterfaceCongestionConfig(TopoConfig):
|
||||
routerIP = rSubnet + "0.2"
|
||||
return routerIP
|
||||
|
||||
def getServerIP(self):
|
||||
def get_server_ip(self):
|
||||
rSubnet = self.param.get(TopoParameter.RIGHT_SUBNET)
|
||||
serverIP = rSubnet + "0.1"
|
||||
return serverIP
|
||||
|
Loading…
Reference in New Issue
Block a user