diff --git a/core/experience.py b/core/experience.py index 3af754f..80485ab 100644 --- a/core/experience.py +++ b/core/experience.py @@ -7,156 +7,181 @@ class Experience(object): This class is not instantiable as it. You must define a child class with the `NAME` attribute. + + Attributes: + experience_parameter Instance of ExperienceParameter + topo Instance of Topo + topo_config Instance of TopoConfig """ - def __init__(self, xpParam, mpTopo, mpConfig): - self.xpParam = xpParam - self.mpTopo = mpTopo - self.mpConfig = mpConfig - print(self.xpParam) + def __init__(self, experience_parameter, topo, topo_config): + self.experience_parameter = experience_parameter + self.topo = topo + self.topo_config = topo_config - def classicRun(self): + def classic_run(self): + """ + Default function to perform the experiment. It consists into three phases: + - A preparation phase through `prepare()` (generating experiment files,...) + - A running phase through `run()` (where the actual experience takes place) + - A cleaning phase through `clean()` (stopping traffic, removing generated files,...) + + Typically, this function is called in the constructor of child classes. + """ self.prepare() self.run() self.clean() def prepare(self): - self.setupSysctl() - self.runUserspacePM() - self.mpConfig.configureNetwork() - self.changeMetric() - self.putPriorityOnPaths() - self.disableTSO() + """ + Prepare the environment to run the experience. + Typically, when you inherit from this class, you want to extend this + method, while still calling this parent function. + + TODO: split experience traffic and protocol configuration + """ + self.setup_sysctl() + self.run_userspace_path_manager() # TODO to move elsewhere + self.topo_config.configure_network() + self.change_metric() # TODO to move elsewhere + self.put_priority_on_paths() # TODO to move elsewhere + self.disable_tso() self.runTcpDump() self.runNetemAt() - pass - def changeMetric(self): - metric = self.xpParam.getParam(ExperienceParameter.METRIC) + def change_metric(self): + """ + Function only meaningful for MPTCP and its specific scheduler + """ + metric = self.experience_parameter.get(ExperienceParameter.METRIC) if int(metric) >= 0: - self.mpTopo.notNSCommand("echo " + metric + " > /sys/module/mptcp_sched_metric/parameters/metric") + self.topo.command_global( + "echo {} > /sys/module/mptcp_sched_metric/parameters/metric".format(metric)) - def putPriorityOnPaths(self): + def put_priority_on_paths(self): + """ + Function only meaningful for MPTCP + """ # Only meaningful if mpTopo is instance of MultiInterfaceTopo - if isinstance(self.mpTopo, MultiInterfaceTopo): - prioPath0 = self.xpParam.getParam(ExperienceParameter.PRIOPATH0) - prioPath1 = self.xpParam.getParam(ExperienceParameter.PRIOPATH1) + if isinstance(self.topo, MultiInterfaceTopo): + prioPath0 = self.experience_parameter.get(ExperienceParameter.PRIOPATH0) + prioPath1 = self.experience_parameter.get(ExperienceParameter.PRIOPATH1) if not prioPath0 == prioPath1: - self.mpTopo.commandTo(self.mpConfig.client, "/home/mininet/iproute/ip/ip link set dev " + - self.mpConfig.getClientInterface(0) + " priority " + str(prioPath0)) - self.mpTopo.commandTo(self.mpConfig.router, "/home/mininet/iproute/ip/ip link set dev " + - self.mpConfig.getRouterInterfaceSwitch(0) + " priority " + + self.topo.command_to(self.topo_config.client, "/home/mininet/iproute/ip/ip link set dev " + + self.topo_config.getClientInterface(0) + " priority " + str(prioPath0)) + self.topo.command_to(self.topo_config.router, "/home/mininet/iproute/ip/ip link set dev " + + self.topo_config.getRouterInterfaceSwitch(0) + " priority " + str(prioPath0)) - self.mpTopo.commandTo(self.mpConfig.client, "/home/mininet/iproute/ip/ip link set dev " + - self.mpConfig.getClientInterface(1) + " priority " + str(prioPath1)) - self.mpTopo.commandTo(self.mpConfig.router, "/home/mininet/iproute/ip/ip link set dev " + - self.mpConfig.getRouterInterfaceSwitch(1) + " priority " + + self.topo.command_to(self.topo_config.client, "/home/mininet/iproute/ip/ip link set dev " + + self.topo_config.getClientInterface(1) + " priority " + str(prioPath1)) + self.topo.command_to(self.topo_config.router, "/home/mininet/iproute/ip/ip link set dev " + + self.topo_config.getRouterInterfaceSwitch(1) + " priority " + str(prioPath1)) - backupPath0 = self.xpParam.getParam(ExperienceParameter.BACKUPPATH0) + backupPath0 = self.experience_parameter.get(ExperienceParameter.BACKUPPATH0) if int(backupPath0) > 0: - self.mpTopo.commandTo(self.mpConfig.client, self.mpConfig.interfaceBUPCommand(self.mpConfig.getClientInterface(0))) - self.mpTopo.commandTo(self.mpConfig.router, self.mpConfig.interfaceBUPCommand(self.mpConfig.getRouterInterfaceSwitch(0))) - backupPath1 = self.xpParam.getParam(ExperienceParameter.BACKUPPATH1) + self.topo.command_to(self.topo_config.client, self.topo_config.interfaceBUPCommand(self.topo_config.getClientInterface(0))) + self.topo.command_to(self.topo_config.router, self.topo_config.interfaceBUPCommand(self.topo_config.getRouterInterfaceSwitch(0))) + backupPath1 = self.experience_parameter.get(ExperienceParameter.BACKUPPATH1) if int(backupPath1) > 0: - self.mpTopo.commandTo(self.mpConfig.client, self.mpConfig.interfaceBUPCommand(self.mpConfig.getClientInterface(1))) - self.mpTopo.commandTo(self.mpConfig.router, self.mpConfig.interfaceBUPCommand(self.mpConfig.getRouterInterfaceSwitch(1))) + self.topo.command_to(self.topo_config.client, self.topo_config.interfaceBUPCommand(self.topo_config.getClientInterface(1))) + self.topo.command_to(self.topo_config.router, self.topo_config.interfaceBUPCommand(self.topo_config.getRouterInterfaceSwitch(1))) - def disableTSO(self): - links = self.mpTopo.getLinkCharacteristics() + def disable_tso(self): + links = self.topo.getLinkCharacteristics() i = 0 for l in links: - lname = self.mpConfig.getMidLeftName(i) - rname = self.mpConfig.getMidRightName(i) - lbox = self.mpTopo.getHost(lname) - lif = self.mpConfig.getMidL2RInterface(i) - rif = self.mpConfig.getMidR2LInterface(i) - rbox = self.mpTopo.getHost(rname) + lname = self.topo_config.getMidLeftName(i) + rname = self.topo_config.getMidRightName(i) + lbox = self.topo.get_host(lname) + lif = self.topo_config.getMidL2RInterface(i) + rif = self.topo_config.getMidR2LInterface(i) + rbox = self.topo.get_host(rname) print(str(lname) + " " + str(lif)) print(str(rname) + " " + str(rif)) print("boxes " + str(lbox) + " " + str(rbox)) cmd = "ethtool -K " + lif + " tso off" print(cmd) - self.mpTopo.commandTo(lbox, cmd) + self.topo.command_to(lbox, cmd) cmd = "ethtool -K " + rif + " tso off" print(cmd) - self.mpTopo.commandTo(rbox, cmd) + self.topo.command_to(rbox, cmd) i = i + 1 # And for the server - cmd = "ethtool -K " + self.mpConfig.getServerInterface() + " tso off" + cmd = "ethtool -K " + self.topo_config.getServerInterface() + " tso off" print(cmd) - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, cmd) - cmd = "ethtool -K " + self.mpConfig.getRouterInterfaceSwitch(self.mpConfig.getClientInterfaceCount()) + " tso off" + cmd = "ethtool -K " + self.topo_config.getRouterInterfaceSwitch(self.topo_config.getClientInterfaceCount()) + " tso off" print(cmd) - self.mpTopo.commandTo(self.mpConfig.router, cmd) + self.topo.command_to(self.topo_config.router, cmd) - def runUserspacePM(self): - if self.xpParam.getParam(ExperienceParameter.KERNELPMC) != "netlink": + def run_userspace_path_manager(self): + if self.experience_parameter.get(ExperienceParameter.KERNELPMC) != "netlink": print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !") else: - upmc = self.xpParam.getParam(ExperienceParameter.USERPMC) - upmca = self.xpParam.getParam(ExperienceParameter.USERPMCARGS) - self.mpTopo.commandTo(self.mpConfig.client, upmc + \ + upmc = self.experience_parameter.get(ExperienceParameter.USERPMC) + upmca = self.experience_parameter.get(ExperienceParameter.USERPMCARGS) + self.topo.command_to(self.topo_config.client, upmc + \ " " + upmca + " &>upmc.log &") - if self.xpParam.getParam(ExperienceParameter.KERNELPMS) != "netlink": + if self.experience_parameter.get(ExperienceParameter.KERNELPMS) != "netlink": print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !") else: - upms = self.xpParam.getParam(ExperienceParameter.USERPMS) - upmsa = self.xpParam.getParam(ExperienceParameter.USERPMSARGS) - self.mpTopo.commandTo(self.mpConfig.server, upms + \ + upms = self.experience_parameter.get(ExperienceParameter.USERPMS) + upmsa = self.experience_parameter.get(ExperienceParameter.USERPMSARGS) + self.topo.command_to(self.topo_config.server, upms + \ " " + upmsa + " &>upms.log &") def cleanUserspacePM(self): - if self.xpParam.getParam(ExperienceParameter.KERNELPMC) != "netlink": + if self.experience_parameter.get(ExperienceParameter.KERNELPMC) != "netlink": print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !") else: - upmc = self.xpParam.getParam(ExperienceParameter.USERPMC) - self.mpTopo.commandTo(self.mpConfig.client, "killall " + upmc) - if self.xpParam.getParam(ExperienceParameter.KERNELPMS) != "netlink": + upmc = self.experience_parameter.get(ExperienceParameter.USERPMC) + self.topo.command_to(self.topo_config.client, "killall " + upmc) + if self.experience_parameter.get(ExperienceParameter.KERNELPMS) != "netlink": print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !") else: - upms = self.xpParam.getParam(ExperienceParameter.USERPMS) - self.mpTopo.commandTo(self.mpConfig.server, "killall " + upms) + upms = self.experience_parameter.get(ExperienceParameter.USERPMS) + self.topo.command_to(self.topo_config.server, "killall " + upms) def runNetemAt(self): - if not self.mpTopo.changeNetem == "yes": + if not self.topo.changeNetem == "yes": print("I don't need to change netem") return print("Will change netem config on the fly") - links = self.mpTopo.getLinkCharacteristics() + links = self.topo.getLinkCharacteristics() i = 0 for l in links: - lname = self.mpConfig.getMidLeftName(i) - rname = self.mpConfig.getMidRightName(i) - lbox = self.mpTopo.getHost(lname) - lif = self.mpConfig.getMidL2RInterface(i) - rif = self.mpConfig.getMidR2LInterface(i) - rbox = self.mpTopo.getHost(rname) + lname = self.topo_config.getMidLeftName(i) + rname = self.topo_config.getMidRightName(i) + lbox = self.topo.get_host(lname) + lif = self.topo_config.getMidL2RInterface(i) + rif = self.topo_config.getMidR2LInterface(i) + rbox = self.topo.get_host(rname) print(str(lname) + " " + str(lif)) print(str(rname) + " " + str(rif)) print("boxes " + str(lbox) + " " + str(rbox)) cmd = l.buildBwCmd(lif) print(cmd) - self.mpTopo.commandTo(lbox, cmd) + self.topo.command_to(lbox, cmd) cmd = l.buildBwCmd(rif) print(cmd) - self.mpTopo.commandTo(rbox, cmd) - ilif = self.mpConfig.getMidL2RIncomingInterface(i) - irif = self.mpConfig.getMidR2LIncomingInterface(i) + self.topo.command_to(rbox, cmd) + ilif = self.topo_config.getMidL2RIncomingInterface(i) + irif = self.topo_config.getMidR2LIncomingInterface(i) cmd = l.buildPolicingCmd(ilif) print(cmd) - self.mpTopo.commandTo(lbox, cmd) + self.topo.command_to(lbox, cmd) cmd = l.buildPolicingCmd(irif) print(cmd) - self.mpTopo.commandTo(rbox, cmd) + self.topo.command_to(rbox, cmd) cmd = l.buildNetemCmd(irif) print(cmd) - self.mpTopo.commandTo(rbox, cmd) + self.topo.command_to(rbox, cmd) cmd = l.buildNetemCmd(ilif) print(cmd) - self.mpTopo.commandTo(lbox, cmd) + self.topo.command_to(lbox, cmd) i = i + 1 @@ -164,36 +189,36 @@ class Experience(object): pass def clean(self): - self.mpTopo.commandTo(self.mpConfig.client, + self.topo.command_to(self.topo_config.client, "killall tcpdump") - self.mpTopo.commandTo(self.mpConfig.server, + self.topo.command_to(self.topo_config.server, "killall tcpdump") self.backUpSysctl() self.cleanUserspacePM() pass - def setupSysctl(self): - self.saveSysctl() - self.writeSysctl() + def setup_sysctl(self): + self.save_sysctl() + self.write_sysctl() - def saveSysctl(self): + def save_sysctl(self): self.sysctlBUP = {} - self._saveSysctl(ExperienceParameter.sysctlKey, self.sysctlBUP) + self._save_sysctl(ExperienceParameter.sysctlKey, self.sysctlBUP) self.sysctlBUPC = {} - self._saveSysctl(ExperienceParameter.sysctlKeyClient, self.sysctlBUPC, - ns = True, who = self.mpConfig.client) + self._save_sysctl(ExperienceParameter.sysctlKeyClient, self.sysctlBUPC, + ns = True, who = self.topo_config.client) self.sysctlBUPS = {} - self._saveSysctl(ExperienceParameter.sysctlKeyServer, self.sysctlBUPS, - ns = True, who = self.mpConfig.server) + self._save_sysctl(ExperienceParameter.sysctlKeyServer, self.sysctlBUPS, + ns = True, who = self.topo_config.server) - def _saveSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): + def _save_sysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): for k in sysctlDic: sysctlKey = sysctlDic[k] cmd = self.cmdReadSysctl(sysctlKey) if not ns: - val = self.mpTopo.notNSCommand(cmd) + val = self.topo.command_global(cmd) else: - val = self.mpTopo.commandTo(who, cmd) + val = self.topo.command_to(who, cmd) if val == "Error": print("oooops can't get sysctl " + sysctlKey) else: @@ -207,27 +232,27 @@ class Experience(object): s = "sysctl " + key return s - def cmdWriteSysctl(self, key, value): + def cmd_write_sysctl(self, key, value): s = self.cmdReadSysctl(key) s = s + "=\"" + str(value) + "\"" return s - def writeSysctl(self): - self._writeSysctl(ExperienceParameter.sysctlKey, self.sysctlBUP) - self._writeSysctl(ExperienceParameter.sysctlKeyClient, self.sysctlBUPC, - ns = True, who = self.mpConfig.client) - self._writeSysctl(ExperienceParameter.sysctlKeyServer, self.sysctlBUPS, - ns = True, who = self.mpConfig.server) + def write_sysctl(self): + self._write_sysctl(ExperienceParameter.sysctlKey, self.sysctlBUP) + self._write_sysctl(ExperienceParameter.sysctlKeyClient, self.sysctlBUPC, + ns = True, who = self.topo_config.client) + self._write_sysctl(ExperienceParameter.sysctlKeyServer, self.sysctlBUPS, + ns = True, who = self.topo_config.server) - def _writeSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): + def _write_sysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): for k in sysctlBUP: sysctlKey = sysctlDic[k] - sysctlValue = self.xpParam.getParam(k) - cmd = self.cmdWriteSysctl(sysctlKey,sysctlValue) + sysctlValue = self.experience_parameter.get(k) + cmd = self.cmd_write_sysctl(sysctlKey,sysctlValue) if not ns: - val = self.mpTopo.notNSCommand(cmd) + val = self.topo.command_global(cmd) else: - val = self.mpTopo.commandTo(who, cmd) + val = self.topo.command_to(who, cmd) if val == "Error": print("oooops can't set sysctl " + sysctlKey) @@ -235,20 +260,20 @@ class Experience(object): def backUpSysctl(self): self._backUpSysctl(ExperienceParameter.sysctlKey, self.sysctlBUP) self._backUpSysctl(ExperienceParameter.sysctlKeyClient, self.sysctlBUPC, - ns = True, who = self.mpConfig.client) + ns = True, who = self.topo_config.client) self._backUpSysctl(ExperienceParameter.sysctlKeyServer, self.sysctlBUPS, - ns = True, who = self.mpConfig.server) + ns = True, who = self.topo_config.server) def _backUpSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): for k in sysctlBUP: sysctlKey = sysctlDic[k] sysctlValue = sysctlBUP[k] - cmd = self.cmdWriteSysctl(sysctlKey,sysctlValue) + cmd = self.cmd_write_sysctl(sysctlKey,sysctlValue) if not ns: - val = self.mpTopo.notNSCommand(cmd) + val = self.topo.command_global(cmd) else: - val = self.mpTopo.commandTo(who, cmd) + val = self.topo.command_to(who, cmd) if val == "Error": print("oooops can't set sysctl " + sysctlKey) @@ -256,14 +281,14 @@ class Experience(object): def runTcpDump(self): #todo : replace filename by cst - cpcap = self.xpParam.getParam(ExperienceParameter.CLIENTPCAP) - spcap = self.xpParam.getParam(ExperienceParameter.SERVERPCAP) - snaplenpcap = self.xpParam.getParam(ExperienceParameter.SNAPLENPCAP) + cpcap = self.experience_parameter.get(ExperienceParameter.CLIENTPCAP) + spcap = self.experience_parameter.get(ExperienceParameter.SERVERPCAP) + snaplenpcap = self.experience_parameter.get(ExperienceParameter.SNAPLENPCAP) if cpcap == "yes" : - self.mpTopo.commandTo(self.mpConfig.client, + self.topo.command_to(self.topo_config.client, "tcpdump -i any -s " + snaplenpcap + " -w client.pcap &") if spcap == "yes" : - self.mpTopo.commandTo(self.mpConfig.server, + self.topo.command_to(self.topo_config.server, "tcpdump -i any -s " + snaplenpcap + " -w server.pcap &") if spcap == "yes" or cpcap == "yes": - self.mpTopo.commandTo(self.mpConfig.client,"sleep 5") + self.topo.command_to(self.topo_config.client,"sleep 5") diff --git a/core/parameter.py b/core/parameter.py index 2b583a1..feff15a 100644 --- a/core/parameter.py +++ b/core/parameter.py @@ -32,7 +32,7 @@ class Parameter(object): print("In file " + paramFile) f.close() - def getParam(self, key): + def get(self, key): if key in self.paramDic: return self.paramDic[key] return None @@ -210,8 +210,8 @@ class ExperienceParameter(Parameter): def __init__(self, paramFile): super(ExperienceParameter, self).__init__(paramFile) - def getParam(self, key): - val = super(ExperienceParameter, self).getParam(key) + def get(self, key): + val = super(ExperienceParameter, self).get(key) if val is None: if key in ExperienceParameter.defaultValue: return ExperienceParameter.defaultValue[key] diff --git a/core/topo.py b/core/topo.py index 39a7146..b0ebcf3 100644 --- a/core/topo.py +++ b/core/topo.py @@ -132,7 +132,7 @@ class TopoParameter(Parameter): print(self.__str__()) def loadNetemAt(self): - if not self.getParam(TopoParameter.changeNetem) == "yes": + if not self.get(TopoParameter.changeNetem) == "yes": return for k in sorted(self.paramDic): if k.startswith(TopoParameter.netemAt): @@ -182,8 +182,8 @@ class TopoParameter(Parameter): print("Ignored path :") print(self.paramDic[k]) - def getParam(self, key): - val = Parameter.getParam(self, key) + def get(self, key): + val = Parameter.get(self, key) if val is None: if key in TopoParameter.defaultValue: return TopoParameter.defaultValue[key] @@ -207,8 +207,8 @@ class Topo(object): This class is not instantiable as it. You must define a child class with the `NAME` attribute. """ - mininetBuilder = "mininet" - topoAttr = "topoType" + MININET_BUILDER = "mininet" + TOPO_ATTR = "topoType" switchNamePrefix = "s" routerNamePrefix = "r" clientName = "Client" @@ -220,25 +220,25 @@ class Topo(object): def __init__(self, topoBuilder, topoParam): self.topoBuilder = topoBuilder self.topoParam = topoParam - self.changeNetem = topoParam.getParam(TopoParameter.changeNetem) + self.changeNetem = topoParam.get(TopoParameter.changeNetem) self.logFile = open(Topo.cmdLog, 'w') def getLinkCharacteristics(self): return self.topoParam.linkCharacteristics - def commandTo(self, who, cmd): + def command_to(self, who, cmd): self.logFile.write(who.__str__() + " : " + cmd + "\n") - return self.topoBuilder.commandTo(who, cmd) + return self.topoBuilder.command_to(who, cmd) - def notNSCommand(self, cmd): + def command_global(self, cmd): """ mainly use for not namespace sysctl. """ self.logFile.write("Not_NS" + " : " + cmd + "\n") - return self.topoBuilder.notNSCommand(cmd) + return self.topoBuilder.command_global(cmd) - def getHost(self, who): - return self.topoBuilder.getHost(who) + def get_host(self, who): + return self.topoBuilder.get_host(who) def addHost(self, host): return self.topoBuilder.addHost(host) @@ -249,17 +249,17 @@ class Topo(object): def addLink(self, fromA, toB, **kwargs): self.topoBuilder.addLink(fromA,toB,**kwargs) - def getCLI(self): - self.topoBuilder.getCLI() + def get_cli(self): + self.topoBuilder.get_cli() - def startNetwork(self): - self.topoBuilder.startNetwork() + def start_network(self): + self.topoBuilder.start_network() def closeLogFile(self): self.logFile.close() - def stopNetwork(self): - self.topoBuilder.stopNetwork() + def stop_network(self): + self.topoBuilder.stop_network() class TopoConfig(object): @@ -276,7 +276,7 @@ class TopoConfig(object): self.topo = topo self.param = param - def configureNetwork(self): + def configure_network(self): print("Configure interfaces....Generic call ?") self.configureInterfaces() self.configureRoute() diff --git a/experiences/ab.py b/experiences/ab.py index 00df41c..bb83c64 100644 --- a/experiences/ab.py +++ b/experiences/ab.py @@ -9,20 +9,20 @@ class AB(Experience): AB_BIN = "ab" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(AB, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(AB, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(AB, self).classicRun() + super(AB, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, + self.topo.command_to(self.topo_config.client, "rm " + AB.PING_OUTPUT) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -31,19 +31,19 @@ class AB(Experience): return s def loadParam(self): - self.file = self.xpParam.getParam(ExperienceParameter.HTTPFILE) - self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPRANDOMSIZE) - self.concurrent_requests = self.xpParam.getParam(ExperienceParameter.ABCONCURRENTREQUESTS) - self.timelimit = self.xpParam.getParam(ExperienceParameter.ABTIMELIMIT) + self.file = self.experience_parameter.get(ExperienceParameter.HTTPFILE) + self.random_size = self.experience_parameter.get(ExperienceParameter.HTTPRANDOMSIZE) + self.concurrent_requests = self.experience_parameter.get(ExperienceParameter.ABCONCURRENTREQUESTS) + self.timelimit = self.experience_parameter.get(ExperienceParameter.ABTIMELIMIT) def prepare(self): Experience.prepare(self) - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ AB.CLIENT_LOG ) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ AB.SERVER_LOG ) if self.file == "random": - self.mpTopo.commandTo(self.mpConfig.client, + self.topo.command_to(self.topo_config.client, "dd if=/dev/urandom of=random bs=1K count=" + \ self.random_size) @@ -55,7 +55,7 @@ class AB(Experience): def getAbClientCmd(self): s = AB.AB_BIN + " -c " + self.concurrent_requests + " -t " + \ - self.timelimit + " http://" + self.mpConfig.getServerIP() + "/" + self.file + \ + self.timelimit + " http://" + self.topo_config.getServerIP() + "/" + self.file + \ " &>" + AB.CLIENT_LOG print(s) return s @@ -63,16 +63,16 @@ class AB(Experience): def clean(self): Experience.clean(self) if self.file == "random": - self.mpTopo.commandTo(self.mpConfig.client, "rm random*") + self.topo.command_to(self.topo_config.client, "rm random*") #todo use cst - #self.mpTopo.commandTo(self.mpConfig.server, "killall netcat") + #self.topo.command_to(self.topo_config.server, "killall netcat") def run(self): cmd = self.getAbServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "sleep 2") cmd = self.getAbClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, cmd) + self.topo.command_to(self.topo_config.client, "sleep 2") diff --git a/experiences/ditg.py b/experiences/ditg.py index b118192..03fa96e 100644 --- a/experiences/ditg.py +++ b/experiences/ditg.py @@ -14,20 +14,20 @@ class DITG(Experience): PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(DITG, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(DITG, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(DITG, self).classicRun() + super(DITG, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ Experience.PING_OUTPUT) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -36,21 +36,21 @@ class DITG(Experience): return s def loadParam(self): - self.kbytes = self.xpParam.getParam(ExperienceParameter.DITGKBYTES) - self.constant_packet_size = self.xpParam.getParam(ExperienceParameter.DITGCONSTANTPACKETSIZE) - self.mean_poisson_packets_sec = self.xpParam.getParam(ExperienceParameter.DITGMEANPOISSONPACKETSSEC) - self.constant_packets_sec = self.xpParam.getParam(ExperienceParameter.DITGCONSTANTPACKETSSEC) - self.bursts_on_packets_sec = self.xpParam.getParam(ExperienceParameter.DITGBURSTSONPACKETSSEC) - self.bursts_off_packets_sec = self.xpParam.getParam(ExperienceParameter.DITGBURSTSOFFPACKETSSEC) + self.kbytes = self.experience_parameter.get(ExperienceParameter.DITGKBYTES) + self.constant_packet_size = self.experience_parameter.get(ExperienceParameter.DITGCONSTANTPACKETSIZE) + self.mean_poisson_packets_sec = self.experience_parameter.get(ExperienceParameter.DITGMEANPOISSONPACKETSSEC) + self.constant_packets_sec = self.experience_parameter.get(ExperienceParameter.DITGCONSTANTPACKETSSEC) + self.bursts_on_packets_sec = self.experience_parameter.get(ExperienceParameter.DITGBURSTSONPACKETSSEC) + self.bursts_off_packets_sec = self.experience_parameter.get(ExperienceParameter.DITGBURSTSOFFPACKETSSEC) def prepare(self): super(DITG, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + DITG.DITG_LOG) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + DITG.DITG_SERVER_LOG) - self.mpTopo.commandTo(self.mpConfig.client, "rm " + DITG.DITG_TEMP_LOG) + self.topo.command_to(self.topo_config.client, "rm " + DITG.DITG_LOG) + self.topo.command_to(self.topo_config.server, "rm " + DITG.DITG_SERVER_LOG) + self.topo.command_to(self.topo_config.client, "rm " + DITG.DITG_TEMP_LOG) def getClientCmd(self): - s = DITG.ITGSEND_BIN + " -a " + self.mpConfig.getServerIP() + \ + s = DITG.ITGSEND_BIN + " -a " + self.topo_config.getServerIP() + \ " -T TCP -k " + self.kbytes + " -l " + DITG.DITG_TEMP_LOG if self.constant_packet_size != "0": @@ -76,11 +76,11 @@ class DITG(Experience): def run(self): cmd = self.getServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "sleep 2") cmd = self.getClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, cmd) - self.mpTopo.commandTo(self.mpConfig.server, "pkill -9 -f ITGRecv") - self.mpTopo.commandTo(self.mpConfig.server, DITG.ITGDEC_BIN + " " + DITG.DITG_SERVER_TEMP_LOG + " &> " + DITG.DITG_SERVER_LOG) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, cmd) + self.topo.command_to(self.topo_config.server, "pkill -9 -f ITGRecv") + self.topo.command_to(self.topo_config.server, DITG.ITGDEC_BIN + " " + DITG.DITG_SERVER_TEMP_LOG + " &> " + DITG.DITG_SERVER_LOG) + self.topo.command_to(self.topo_config.client, "sleep 2") diff --git a/experiences/epload.py b/experiences/epload.py index c1ea6ac..b727dbd 100644 --- a/experiences/epload.py +++ b/experiences/epload.py @@ -10,20 +10,20 @@ class Epload(Experience): EPLOAD_EMULATOR="/home/mininet/epload/epload/emulator/run.js" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(Epload, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(Epload, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(Epload, self).classicRun() + super(Epload, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ Epload.PING_OUTPUT ) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -32,13 +32,13 @@ class Epload(Experience): return s def loadParam(self): - self.epload_test_dir = self.xpParam.getParam(ExperienceParameter.EPLOADTESTDIR) + self.epload_test_dir = self.experience_parameter.get(ExperienceParameter.EPLOADTESTDIR) def prepare(self): super(Epload, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ Epload.EPLOAD_LOG ) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ Epload.SERVER_LOG ) def getHTTPServerCmd(self): @@ -60,14 +60,14 @@ class Epload(Experience): def getSubHostCmd(self): s = "for f in `ls " + self.epload_test_dir + "/*`; do " + \ - " sed -i 's/@host@/" + self.mpConfig.getServerIP() + "/' " + \ + " sed -i 's/@host@/" + self.topo_config.getServerIP() + "/' " + \ "$f; done" print(s) return s def getSubBackHostCmd(self): s = "for f in `ls " + self.epload_test_dir + "/*`; do " + \ - " sed -i 's/" + self.mpConfig.getServerIP() + "/@host@/' " + \ + " sed -i 's/" + self.topo_config.getServerIP() + "/@host@/' " + \ "$f; done" print(s) return s @@ -77,16 +77,16 @@ class Epload(Experience): def run(self): cmd = self.getHTTPServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.server, cmd) + self.topo.command_to(self.topo_config.client, "sleep 2") cmd = self.getSubHostCmd() - self.mpTopo.commandTo(self.mpConfig.client, cmd) + self.topo.command_to(self.topo_config.client, cmd) cmd = self.getEploadClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, cmd) + self.topo.command_to(self.topo_config.client, cmd) cmd = self.getSubBackHostCmd() - self.mpTopo.commandTo(self.mpConfig.client, cmd) + self.topo.command_to(self.topo_config.client, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "sleep 2") cmd = self.getKillHTTPCmd() - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, cmd) diff --git a/experiences/http.py b/experiences/http.py index 9d8e543..6c616ca 100644 --- a/experiences/http.py +++ b/experiences/http.py @@ -9,20 +9,20 @@ class HTTP(Experience): WGET_BIN = "wget" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(HTTP, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(HTTP, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(HTTP, self).classicRun() + super(HTTP, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ HTTP.PING_OUTPUT ) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -31,17 +31,17 @@ class HTTP(Experience): return s def loadParam(self): - self.file = self.xpParam.getParam(ExperienceParameter.HTTPFILE) - self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPRANDOMSIZE) + self.file = self.experience_parameter.get(ExperienceParameter.HTTPFILE) + self.random_size = self.experience_parameter.get(ExperienceParameter.HTTPRANDOMSIZE) def prepare(self): super(HTTP, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ HTTP.CLIENT_LOG ) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ HTTP.SERVER_LOG ) if self.file == "random": - self.mpTopo.commandTo(self.mpConfig.client, + self.topo.command_to(self.topo_config.client, "dd if=/dev/urandom of=random bs=1K count=" + \ self.random_size) @@ -51,7 +51,7 @@ class HTTP(Experience): return s def getHTTPClientCmd(self): - s = "(time " + HTTP.WGET_BIN + " http://" + self.mpConfig.getServerIP() + \ + s = "(time " + HTTP.WGET_BIN + " http://" + self.topo_config.getServerIP() + \ "/" + self.file + " --no-check-certificate) &>" + HTTP.CLIENT_LOG print(s) return s @@ -59,17 +59,17 @@ class HTTP(Experience): def clean(self): super(HTTP, self).clean() if self.file == "random": - self.mpTopo.commandTo(self.mpConfig.client, "rm random*") + self.topo.command_to(self.topo_config.client, "rm random*") def run(self): cmd = self.getHTTPServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before") - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before") + self.topo.command_to(self.topo_config.server, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "sleep 2") cmd = self.getHTTPClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before") - self.mpTopo.commandTo(self.mpConfig.client, cmd) - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after") - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after") - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before") + self.topo.command_to(self.topo_config.client, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_after") + self.topo.command_to(self.topo_config.client, "sleep 2") diff --git a/experiences/https.py b/experiences/https.py index 01397ec..6b78994 100644 --- a/experiences/https.py +++ b/experiences/https.py @@ -9,20 +9,20 @@ class HTTPS(Experience): WGET_BIN = "wget" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(HTTPS, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(HTTPS, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(HTTPS, self).classicRun() + super(HTTPS, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ HTTPS.PING_OUTPUT ) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -31,17 +31,17 @@ class HTTPS(Experience): return s def loadParam(self): - self.file = self.xpParam.getParam(ExperienceParameter.HTTPSFILE) - self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPSRANDOMSIZE) + self.file = self.experience_parameter.get(ExperienceParameter.HTTPSFILE) + self.random_size = self.experience_parameter.get(ExperienceParameter.HTTPSRANDOMSIZE) def prepare(self): super(HTTPS, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ HTTPS.CLIENT_LOG ) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ HTTPS.SERVER_LOG ) if self.file == "random": - self.mpTopo.commandTo(self.mpConfig.client, + self.topo.command_to(self.topo_config.client, "dd if=/dev/urandom of=random bs=1K count=" + \ self.random_size) @@ -52,7 +52,7 @@ class HTTPS(Experience): return s def getHTTPSClientCmd(self): - s = "(time " + HTTPS.WGET_BIN + " https://" + self.mpConfig.getServerIP() + \ + s = "(time " + HTTPS.WGET_BIN + " https://" + self.topo_config.getServerIP() + \ "/" + self.file + " --no-check-certificate) &>" + HTTPS.CLIENT_LOG print(s) return s @@ -60,19 +60,19 @@ class HTTPS(Experience): def clean(self): super(HTTPS, self).clean() if self.file == "random": - self.mpTopo.commandTo(self.mpConfig.client, "rm random*") + self.topo.command_to(self.topo_config.client, "rm random*") def run(self): cmd = self.getHTTPSServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before") - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before") + self.topo.command_to(self.topo_config.server, cmd) print("Waiting for the server to run") - self.mpTopo.commandTo(self.mpConfig.client, "sleep 15") + self.topo.command_to(self.topo_config.client, "sleep 15") cmd = self.getHTTPSClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before") - self.mpTopo.commandTo(self.mpConfig.client, cmd) - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after") - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after") - self.mpTopo.commandTo(self.mpConfig.server, "pkill -f https_server.py") - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before") + self.topo.command_to(self.topo_config.client, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_after") + self.topo.command_to(self.topo_config.server, "pkill -f https_server.py") + self.topo.command_to(self.topo_config.client, "sleep 2") diff --git a/experiences/iperf.py b/experiences/iperf.py index 1b37d97..6246ec6 100644 --- a/experiences/iperf.py +++ b/experiences/iperf.py @@ -9,20 +9,20 @@ class IPerf(Experience): IPERF_BIN = "iperf3" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(IPerf, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(IPerf, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(IPerf, self).classicRun() + super(IPerf, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ IPerf.PING_OUTPUT) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -31,18 +31,18 @@ class IPerf(Experience): return s def loadParam(self): - self.time = self.xpParam.getParam(ExperienceParameter.IPERFTIME) - self.parallel = self.xpParam.getParam(ExperienceParameter.IPERFPARALLEL) + self.time = self.experience_parameter.get(ExperienceParameter.IPERFTIME) + self.parallel = self.experience_parameter.get(ExperienceParameter.IPERFPARALLEL) def prepare(self): super(IPerf, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + + self.topo.command_to(self.topo_config.client, "rm " + IPerf.IPERF_LOG) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + + self.topo.command_to(self.topo_config.server, "rm " + IPerf.SERVER_LOG) def getClientCmd(self): - s = IPerf.IPERF_BIN + " -c " + self.mpConfig.getServerIP() + \ + s = IPerf.IPERF_BIN + " -c " + self.topo_config.getServerIP() + \ " -t " + self.time + " -P " + self.parallel + " &>" + IPerf.IPERF_LOG print(s) return s @@ -58,9 +58,9 @@ class IPerf(Experience): def run(self): cmd = self.getServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "sleep 2") cmd = self.getClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, cmd) + self.topo.command_to(self.topo_config.client, "sleep 2") diff --git a/experiences/msg.py b/experiences/msg.py index 828a7e0..6244274 100644 --- a/experiences/msg.py +++ b/experiences/msg.py @@ -9,20 +9,20 @@ class Msg(Experience): CLIENT_ERR = "msg_client.err" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(Msg, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(Msg, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(Msg, self).classicRun() + super(Msg, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ Msg.PING_OUTPUT ) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -31,16 +31,16 @@ class Msg(Experience): return s def loadParam(self): - self.client_sleep = self.xpParam.getParam(ExperienceParameter.MSGCLIENTSLEEP) - self.server_sleep = self.xpParam.getParam(ExperienceParameter.MSGSERVERSLEEP) - self.nb_requests = self.xpParam.getParam(ExperienceParameter.MSGNBREQUESTS) - self.bytes = self.xpParam.getParam(ExperienceParameter.MSGBYTES) + self.client_sleep = self.experience_parameter.get(ExperienceParameter.MSGCLIENTSLEEP) + self.server_sleep = self.experience_parameter.get(ExperienceParameter.MSGSERVERSLEEP) + self.nb_requests = self.experience_parameter.get(ExperienceParameter.MSGNBREQUESTS) + self.bytes = self.experience_parameter.get(ExperienceParameter.MSGBYTES) def prepare(self): super(Msg, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ Msg.CLIENT_LOG) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ Msg.SERVER_LOG) def getMsgServerCmd(self): @@ -61,14 +61,14 @@ class Msg(Experience): def run(self): cmd = self.getMsgServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before") - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before") + self.topo.command_to(self.topo_config.server, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "sleep 2") cmd = self.getMsgClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before") - self.mpTopo.commandTo(self.mpConfig.client, cmd) - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after") - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after") - self.mpTopo.commandTo(self.mpConfig.server, "pkill -f msg_server.py") - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before") + self.topo.command_to(self.topo_config.client, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_after") + self.topo.command_to(self.topo_config.server, "pkill -f msg_server.py") + self.topo.command_to(self.topo_config.client, "sleep 2") diff --git a/experiences/nc.py b/experiences/nc.py index 50e2ade..3631cb0 100644 --- a/experiences/nc.py +++ b/experiences/nc.py @@ -12,30 +12,30 @@ class NC(Experience): CLIENT_NC_LOG = "netcat_client" NC_BIN = "netcat" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(NC, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(NC, self).__init__(experience_parameter, topo, topo_config) self.loadParam() - super(NC, self).classicRun() + super(NC, self).classic_run() def loadParam(self): - self.ddibs = self.xpParam.getParam(ExperienceParameter.DDIBS) - self.ddobs = self.xpParam.getParam(ExperienceParameter.DDOBS) - self.ddcount = self.xpParam.getParam(ExperienceParameter.DDCOUNT) - self.ncServerPort = self.xpParam.getParam(ExperienceParameter.NCSERVERPORT) + self.ddibs = self.experience_parameter.get(ExperienceParameter.DDIBS) + self.ddobs = self.experience_parameter.get(ExperienceParameter.DDOBS) + self.ddcount = self.experience_parameter.get(ExperienceParameter.DDCOUNT) + self.ncServerPort = self.experience_parameter.get(ExperienceParameter.NCSERVERPORT) self.ncClientPort = [] - for k in sorted(self.xpParam.paramDic): + for k in sorted(self.experience_parameter.paramDic): if k.startswith(ExperienceParameter.NCCLIENTPORT): - port = self.xpParam.paramDic[k] + port = self.experience_parameter.paramDic[k] self.ncClientPort.append(port) if len(self.ncClientPort) == 0: - d = self.xpParam.getParam(ExperienceParameter.NCCLIENTPORT) + d = self.experience_parameter.get(ExperienceParameter.NCCLIENTPORT) self.ncClientPort.append(d) def prepare(self): super(NC, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ NC.CLIENT_NC_LOG ) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ NC.SERVER_NC_LOG ) def getNCServerCmd(self, id): @@ -53,7 +53,7 @@ class NC(Experience): def getNCClientCmd(self, id): s = NC.NC_BIN + " " + \ " -p " + self.ncClientPort[id] + " " + \ - self.mpConfig.getServerIP() + " " + \ + self.topo_config.getServerIP() + " " + \ self.ncServerPort + " " + \ "&>" + NC.CLIENT_NC_LOG + \ "_" + str(id) + ".log" @@ -62,17 +62,17 @@ class NC(Experience): def clean(self): super(NC, self).clean() - self.mpTopo.commandTo(self.mpConfig.server, "killall netcat") + self.topo.command_to(self.topo_config.server, "killall netcat") def run(self): for i in range(0, len(self.ncClientPort)): cmd = self.getNCServerCmd(i) - self.mpConfig.server.sendCmd(cmd) + self.topo_config.server.sendCmd(cmd) cmd = self.getNCClientCmd(i) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + self.topo.command_to(self.topo_config.client, cmd) - self.mpConfig.server.waitOutput() + self.topo_config.server.waitOutput() - self.mpTopo.commandTo(self.mpConfig.client, "sleep 1") + self.topo.command_to(self.topo_config.client, "sleep 1") diff --git a/experiences/ncpv.py b/experiences/ncpv.py index 3f5b3d7..837bf45 100644 --- a/experiences/ncpv.py +++ b/experiences/ncpv.py @@ -24,20 +24,20 @@ class NCPV(Experience): PV_BIN = "/usr/local/bin/pv" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(NCPV, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(NCPV, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(NCPV, self).classicRun() + super(NCPV, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ NCPV.PING_OUTPUT ) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -46,31 +46,31 @@ class NCPV(Experience): return s def loadParam(self): - self.pvg = self.xpParam.getParam(ExperienceParameter.PVG) - self.pvz = self.xpParam.getParam(ExperienceParameter.PVZ) - self.pvRateLimit = self.xpParam.getParam(ExperienceParameter.PVRATELIMIT) - self.ddibs = self.xpParam.getParam(ExperienceParameter.DDIBS) - self.ddobs = self.xpParam.getParam(ExperienceParameter.DDOBS) - self.ddcount = self.xpParam.getParam(ExperienceParameter.DDCOUNT) - self.ncServerPort = self.xpParam.getParam(ExperienceParameter.NCSERVERPORT) - self.pvRateLimit = self.xpParam.getParam(ExperienceParameter.PVRATELIMIT) + self.pvg = self.experience_parameter.get(ExperienceParameter.PVG) + self.pvz = self.experience_parameter.get(ExperienceParameter.PVZ) + self.pvRateLimit = self.experience_parameter.get(ExperienceParameter.PVRATELIMIT) + self.ddibs = self.experience_parameter.get(ExperienceParameter.DDIBS) + self.ddobs = self.experience_parameter.get(ExperienceParameter.DDOBS) + self.ddcount = self.experience_parameter.get(ExperienceParameter.DDCOUNT) + self.ncServerPort = self.experience_parameter.get(ExperienceParameter.NCSERVERPORT) + self.pvRateLimit = self.experience_parameter.get(ExperienceParameter.PVRATELIMIT) self.ncClientPort = [] - for k in sorted(self.xpParam.paramDic): + for k in sorted(self.experience_parameter.paramDic): if k.startswith(ExperienceParameter.NCCLIENTPORT): - port = self.xpParam.paramDic[k] + port = self.experience_parameter.paramDic[k] self.ncClientPort.append(port) if len(self.ncClientPort) == 0: - d = self.xpParam.getParam(ExperienceParameter.NCCLIENTPORT) + d = self.experience_parameter.get(ExperienceParameter.NCCLIENTPORT) self.ncClientPort.append(d) self.loadPvAt() def loadPvAt(self): self.changePvAt = [] - self.changePv = self.xpParam.getParam(ExperienceParameter.CHANGEPV) + self.changePv = self.experience_parameter.get(ExperienceParameter.CHANGEPV) if self.changePv != "yes": print("Don't change pv rate...") return - changePvAt = self.xpParam.getParam(ExperienceParameter.CHANGEPVAT) + changePvAt = self.experience_parameter.get(ExperienceParameter.CHANGEPVAT) if not isinstance(changePvAt, list): changePvAt = [changePvAt] for p in changePvAt: @@ -106,9 +106,9 @@ class NCPV(Experience): def prepare(self): super(NCPV, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ NCPV.CLIENT_NC_LOG ) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ NCPV.SERVER_NC_LOG ) def getNCServerCmd(self, id): @@ -128,7 +128,7 @@ class NCPV(Experience): " -q --rate-limit " + self.pvRateLimit + \ " | " + NCPV.NC_BIN + " " + \ " -p " + self.ncClientPort[id] + " " + \ - self.mpConfig.getServerIP() + " " + \ + self.topo_config.getServerIP() + " " + \ self.ncServerPort + " " + \ "&>" + NCPV.CLIENT_NC_LOG + \ "_" + str(id) + ".log" @@ -140,28 +140,28 @@ class NCPV(Experience): def clean(self): super(NCPV, self).clean() - self.mpTopo.commandTo(self.mpConfig.server, "killall netcat") + self.topo.command_to(self.topo_config.server, "killall netcat") def run(self): for i in range(0, len(self.ncClientPort)): cmd = self.getNCServerCmd(i) - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, cmd) cmd = self.getNCClientCmd(i) - self.mpConfig.client.sendCmd(cmd) + self.topo_config.client.sendCmd(cmd) cmd = self.getPvPidCmd() self.pvPid = None while self.pvPid == None or self.pvPid == "": - self.pvPid = self.mpTopo.commandTo(self.mpConfig.server, cmd)[:-1] + self.pvPid = self.topo.command_to(self.topo_config.server, cmd)[:-1] print("guessing pv pid ... :" + str(self.pvPid)) cmd = self.getPvChangeCmd() print(cmd) - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, cmd) - self.mpConfig.client.waitOutput() + self.topo_config.client.waitOutput() - self.mpTopo.commandTo(self.mpConfig.client, "sleep 1") + self.topo.command_to(self.topo_config.client, "sleep 1") diff --git a/experiences/netperf.py b/experiences/netperf.py index 97a2802..d596da0 100644 --- a/experiences/netperf.py +++ b/experiences/netperf.py @@ -10,20 +10,20 @@ class Netperf(Experience): NETSERVER_BIN = "netserver" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(Netperf, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(Netperf, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(Netperf, self).classicRun() + super(Netperf, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ Netperf.PING_OUTPUT) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -32,19 +32,19 @@ class Netperf(Experience): return s def loadParam(self): - self.testlen = self.xpParam.getParam(ExperienceParameter.NETPERFTESTLEN) - self.testname = self.xpParam.getParam(ExperienceParameter.NETPERFTESTNAME) - self.reqres_size = self.xpParam.getParam(ExperienceParameter.NETPERFREQRESSIZE) + self.testlen = self.experience_parameter.get(ExperienceParameter.NETPERFTESTLEN) + self.testname = self.experience_parameter.get(ExperienceParameter.NETPERFTESTNAME) + self.reqres_size = self.experience_parameter.get(ExperienceParameter.NETPERFREQRESSIZE) def prepare(self): super(Netperf, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + + self.topo.command_to(self.topo_config.client, "rm " + Netperf.NETPERF_LOG) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + + self.topo.command_to(self.topo_config.server, "rm " + Netperf.NETSERVER_LOG) def getClientCmd(self): - s = Netperf.NETPERF_BIN + " -H " + self.mpConfig.getServerIP() + \ + s = Netperf.NETPERF_BIN + " -H " + self.topo_config.getServerIP() + \ " -l " + self.testlen + " -t " + self.testname + " -- -r " + self.reqres_size + \ " &>" + Netperf.NETPERF_LOG print(s) @@ -61,9 +61,9 @@ class Netperf(Experience): def run(self): cmd = self.getServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "sleep 2") cmd = self.getClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, cmd) + self.topo.command_to(self.topo_config.client, "sleep 2") diff --git a/experiences/none.py b/experiences/none.py index 519c86e..eb661e0 100644 --- a/experiences/none.py +++ b/experiences/none.py @@ -3,9 +3,9 @@ from core.experience import Experience, ExperienceParameter class NoneExperience(Experience): NAME = "none" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(NoneExperience, self).__init__(xpParamFile, mpTopo, mpConfig) - super(NoneExperience, self).classicRun() + def __init__(self, experience_parameter, topo, topo_config): + super(NoneExperience, self).__init__(experience_parameter, topo, topo_config) + super(NoneExperience, self).classic_run() def prepare(self): Experience.prepare(self) @@ -14,4 +14,4 @@ class NoneExperience(Experience): Experience.clean(self) def run(self): - self.mpTopo.getCLI() + self.topo.get_cli() diff --git a/experiences/ping.py b/experiences/ping.py index 0e2af0a..b22b41a 100644 --- a/experiences/ping.py +++ b/experiences/ping.py @@ -5,9 +5,9 @@ class Ping(Experience): PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(Ping, self).__init__(xpParamFile, mpTopo, mpConfig) - super(Ping, self).classicRun() + def __init__(self, experience_parameter, topo, topo_config): + super(Ping, self).__init__(experience_parameter, topo, topo_config) + super(Ping, self).classic_run() def prepare(self): super(Ping, self).prepare() @@ -16,13 +16,13 @@ class Ping(Experience): super(Ping, self).clean() def run(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ Ping.PING_OUTPUT ) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ diff --git a/experiences/quic.py b/experiences/quic.py index fe7a266..7426ca9 100644 --- a/experiences/quic.py +++ b/experiences/quic.py @@ -15,20 +15,20 @@ class QUIC(Experience): CERTPATH = "~/go/src/github.com/lucas-clemente/quic-go/example/" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(QUIC, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(QUIC, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(QUIC, self).classicRun() + super(QUIC, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ QUIC.PING_OUTPUT ) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -37,18 +37,18 @@ class QUIC(Experience): return s def loadParam(self): - self.file = self.xpParam.getParam(ExperienceParameter.HTTPSFILE) - self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPSRANDOMSIZE) - self.multipath = self.xpParam.getParam(ExperienceParameter.QUICMULTIPATH) + self.file = self.experience_parameter.get(ExperienceParameter.HTTPSFILE) + self.random_size = self.experience_parameter.get(ExperienceParameter.HTTPSRANDOMSIZE) + self.multipath = self.experience_parameter.get(ExperienceParameter.QUICMULTIPATH) def prepare(self): super(QUIC, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ QUIC.CLIENT_LOG ) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ QUIC.SERVER_LOG ) if self.file == "random": - self.mpTopo.commandTo(self.mpConfig.client, + self.topo.command_to(self.topo_config.client, "dd if=/dev/urandom of=random bs=1K count=" + \ self.random_size) @@ -63,7 +63,7 @@ class QUIC(Experience): s = QUIC.GO_BIN + " run " + QUIC.CLIENT_GO_FILE if int(self.multipath) > 0: s += " -m" - s += " https://" + self.mpConfig.getServerIP() + ":6121/random &>" + QUIC.CLIENT_LOG + s += " https://" + self.topo_config.getServerIP() + ":6121/random &>" + QUIC.CLIENT_LOG print(s) return s @@ -74,7 +74,7 @@ class QUIC(Experience): return s def getCongClientCmd(self, congID): - s = "(time " + QUIC.WGET + " https://" + self.mpConfig.getCongServerIP(congID) +\ + s = "(time " + QUIC.WGET + " https://" + self.topo_config.getCongServerIP(congID) +\ "/" + self.file + " --no-check-certificate --disable-mptcp) &> https_client" + str(congID) + ".log &" print(s) return s @@ -82,47 +82,47 @@ class QUIC(Experience): def clean(self): super(QUIC, self).clean() if self.file == "random": - self.mpTopo.commandTo(self.mpConfig.client, "rm random*") + self.topo.command_to(self.topo_config.client, "rm random*") def run(self): cmd = self.getQUICServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before") - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before") + self.topo.command_to(self.topo_config.server, cmd) - if isinstance(self.mpConfig, MultiInterfaceCongConfig): + if isinstance(self.topo_config, MultiInterfaceCongConfig): i = 0 - for cs in self.mpConfig.cong_servers: + for cs in self.topo_config.cong_servers: cmd = self.getCongServerCmd(i) - self.mpTopo.commandTo(cs, cmd) + self.topo.command_to(cs, cmd) i = i + 1 - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "sleep 2") - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before") # First run congestion clients, then the main one - if isinstance(self.mpConfig, MultiInterfaceCongConfig): + if isinstance(self.topo_config, MultiInterfaceCongConfig): i = 0 - for cc in self.mpConfig.cong_clients: + for cc in self.topo_config.cong_clients: cmd = self.getCongClientCmd(i) - self.mpTopo.commandTo(cc, cmd) + self.topo.command_to(cc, cmd) i = i + 1 cmd = self.getQUICClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, cmd) - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after") - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after") + self.topo.command_to(self.topo_config.client, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_after") # Wait for congestion traffic to end - if isinstance(self.mpConfig, MultiInterfaceCongConfig): - for cc in self.mpConfig.cong_clients: - self.mpTopo.commandTo(cc, "while pkill -f wget -0; do sleep 0.5; done") + if isinstance(self.topo_config, MultiInterfaceCongConfig): + for cc in self.topo_config.cong_clients: + self.topo.command_to(cc, "while pkill -f wget -0; do sleep 0.5; done") - self.mpTopo.commandTo(self.mpConfig.server, "pkill -f " + QUIC.SERVER_GO_FILE) - if isinstance(self.mpConfig, MultiInterfaceCongConfig): - for cs in self.mpConfig.cong_servers: - self.mpTopo.commandTo(cs, "pkill -f https_server.py") + self.topo.command_to(self.topo_config.server, "pkill -f " + QUIC.SERVER_GO_FILE) + if isinstance(self.topo_config, MultiInterfaceCongConfig): + for cs in self.topo_config.cong_servers: + self.topo.command_to(cs, "pkill -f https_server.py") - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "sleep 2") # Need to delete the go-build directory in tmp; could lead to no more space left error - self.mpTopo.commandTo(self.mpConfig.client, "rm -r /tmp/go-build*") + self.topo.command_to(self.topo_config.client, "rm -r /tmp/go-build*") # Remove cache data - self.mpTopo.commandTo(self.mpConfig.client, "rm cache_*") + self.topo.command_to(self.topo_config.client, "rm cache_*") diff --git a/experiences/quic_siri.py b/experiences/quic_siri.py index ab68887..1f7ecff 100644 --- a/experiences/quic_siri.py +++ b/experiences/quic_siri.py @@ -12,20 +12,20 @@ class QUICSiri(Experience): SERVER_GO_FILE = "~/go/src/github.com/lucas-clemente/quic-go/example/siri/siri.go" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(QUICSiri, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(QUICSiri, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(QUICSiri, self).classicRun() + super(QUICSiri, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ QUICSiri.PING_OUTPUT ) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -34,14 +34,14 @@ class QUICSiri(Experience): return s def loadParam(self): - self.run_time = self.xpParam.getParam(ExperienceParameter.QUICSIRIRUNTIME) - self.multipath = self.xpParam.getParam(ExperienceParameter.QUICMULTIPATH) + self.run_time = self.experience_parameter.get(ExperienceParameter.QUICSIRIRUNTIME) + self.multipath = self.experience_parameter.get(ExperienceParameter.QUICMULTIPATH) def prepare(self): super(QUICSiri, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ QUICSiri.CLIENT_LOG ) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ QUICSiri.SERVER_LOG ) def getQUICSiriServerCmd(self): @@ -52,7 +52,7 @@ class QUICSiri(Experience): def getQUICSiriClientCmd(self): s = QUICSiri.GO_BIN + " run " + QUICSiri.CLIENT_GO_FILE - s += " -addr " + self.mpConfig.getServerIP() + ":8080 -runTime " + self.run_time + "s" + s += " -addr " + self.topo_config.getServerIP() + ":8080 -runTime " + self.run_time + "s" if int(self.multipath) > 0: s += " -m" s += " &>" + QUICSiri.CLIENT_LOG @@ -64,16 +64,16 @@ class QUICSiri(Experience): def run(self): cmd = self.getQUICSiriServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before") - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before") + self.topo.command_to(self.topo_config.server, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "sleep 2") cmd = self.getQUICSiriClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before") - self.mpTopo.commandTo(self.mpConfig.client, cmd) - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after") - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after") - self.mpTopo.commandTo(self.mpConfig.server, "pkill -f " + QUICSiri.SERVER_GO_FILE) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before") + self.topo.command_to(self.topo_config.client, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_after") + self.topo.command_to(self.topo_config.server, "pkill -f " + QUICSiri.SERVER_GO_FILE) + self.topo.command_to(self.topo_config.client, "sleep 2") # Need to delete the go-build directory in tmp; could lead to no more space left error - self.mpTopo.commandTo(self.mpConfig.client, "rm -r /tmp/go-build*") + self.topo.command_to(self.topo_config.client, "rm -r /tmp/go-build*") diff --git a/experiences/send_file.py b/experiences/send_file.py index ddf3879..aa381cb 100644 --- a/experiences/send_file.py +++ b/experiences/send_file.py @@ -9,20 +9,20 @@ class SendFile(Experience): WGET_BIN = "./client" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(SendFile, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(SendFile, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(SendFile, self).classicRun() + super(SendFile, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ SendFile.PING_OUTPUT ) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -31,17 +31,17 @@ class SendFile(Experience): return s def loadParam(self): - self.file = self.xpParam.getParam(ExperienceParameter.HTTPSFILE) - self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPSRANDOMSIZE) + self.file = self.experience_parameter.get(ExperienceParameter.HTTPSFILE) + self.random_size = self.experience_parameter.get(ExperienceParameter.HTTPSRANDOMSIZE) def prepare(self): super(SendFile, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ SendFile.CLIENT_LOG ) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ SendFile.SERVER_LOG ) if self.file == "random": - self.mpTopo.commandTo(self.mpConfig.client, + self.topo.command_to(self.topo_config.client, "dd if=/dev/urandom of=random bs=1K count=" + \ self.random_size) @@ -51,20 +51,20 @@ class SendFile(Experience): return s def getSendFileClientCmd(self): - s = SendFile.WGET_BIN + " " + self.mpConfig.getServerIP() + " &>" + SendFile.CLIENT_LOG + s = SendFile.WGET_BIN + " " + self.topo_config.getServerIP() + " &>" + SendFile.CLIENT_LOG print(s) return s def clean(self): super(SendFile, self).clean() if self.file == "random": - self.mpTopo.commandTo(self.mpConfig.client, "rm random*") + self.topo.command_to(self.topo_config.client, "rm random*") def run(self): cmd = self.getSendFileServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 0.1") + self.topo.command_to(self.topo_config.client, "sleep 0.1") cmd = self.getSendFileClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, cmd) + self.topo.command_to(self.topo_config.client, "sleep 2") diff --git a/experiences/siri.py b/experiences/siri.py index 2a18d09..e9000e8 100644 --- a/experiences/siri.py +++ b/experiences/siri.py @@ -10,20 +10,20 @@ class Siri(Experience): JAVA_BIN = "java" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(Siri, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(Siri, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(Siri, self).classicRun() + super(Siri, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ Siri.PING_OUTPUT ) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -32,22 +32,22 @@ class Siri(Experience): return s def loadParam(self): - self.run_time = self.xpParam.getParam(ExperienceParameter.SIRIRUNTIME) - self.query_size = self.xpParam.getParam(ExperienceParameter.SIRIQUERYSIZE) - self.response_size = self.xpParam.getParam(ExperienceParameter.SIRIRESPONSESIZE) - self.delay_query_response = self.xpParam.getParam(ExperienceParameter.SIRIDELAYQUERYRESPONSE) - self.min_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMINPAYLOADSIZE) - self.max_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMAXPAYLOADSIZE) - self.interval_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALTIMEMS) - self.buffer_size = self.xpParam.getParam(ExperienceParameter.SIRIBUFFERSIZE) - self.burst_size = self.xpParam.getParam(ExperienceParameter.SIRIBURSTSIZE) - self.interval_burst_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALBURSTTIMEMS) + self.run_time = self.experience_parameter.get(ExperienceParameter.SIRIRUNTIME) + self.query_size = self.experience_parameter.get(ExperienceParameter.SIRIQUERYSIZE) + self.response_size = self.experience_parameter.get(ExperienceParameter.SIRIRESPONSESIZE) + self.delay_query_response = self.experience_parameter.get(ExperienceParameter.SIRIDELAYQUERYRESPONSE) + self.min_payload_size = self.experience_parameter.get(ExperienceParameter.SIRIMINPAYLOADSIZE) + self.max_payload_size = self.experience_parameter.get(ExperienceParameter.SIRIMAXPAYLOADSIZE) + self.interval_time_ms = self.experience_parameter.get(ExperienceParameter.SIRIINTERVALTIMEMS) + self.buffer_size = self.experience_parameter.get(ExperienceParameter.SIRIBUFFERSIZE) + self.burst_size = self.experience_parameter.get(ExperienceParameter.SIRIBURSTSIZE) + self.interval_burst_time_ms = self.experience_parameter.get(ExperienceParameter.SIRIINTERVALBURSTTIMEMS) def prepare(self): super(Siri, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ Siri.CLIENT_LOG) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ Siri.SERVER_LOG) def getSiriServerCmd(self): @@ -58,7 +58,7 @@ class Siri(Experience): def getSiriClientCmd(self): s = Siri.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/utils/siriClient.jar " + \ - self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \ + self.topo_config.getServerIP() + " 8080 " + 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 + " 2>" + Siri.CLIENT_ERR @@ -70,14 +70,14 @@ class Siri(Experience): def run(self): cmd = self.getSiriServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before") - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before") + self.topo.command_to(self.topo_config.server, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "sleep 2") cmd = self.getSiriClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before") - self.mpTopo.commandTo(self.mpConfig.client, cmd) - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after") - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after") - self.mpTopo.commandTo(self.mpConfig.server, "pkill -f siri_server.py") - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before") + self.topo.command_to(self.topo_config.client, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_after") + self.topo.command_to(self.topo_config.server, "pkill -f siri_server.py") + self.topo.command_to(self.topo_config.client, "sleep 2") diff --git a/experiences/siri_http.py b/experiences/siri_http.py index da9ac61..8b637dd 100644 --- a/experiences/siri_http.py +++ b/experiences/siri_http.py @@ -13,20 +13,20 @@ class SiriHTTP(Experience): JAVA_BIN = "java" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(SiriHTTP, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(SiriHTTP, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(SiriHTTP, self).classicRun() + super(SiriHTTP, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ SiriHTTP.PING_OUTPUT ) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -35,31 +35,31 @@ class SiriHTTP(Experience): return s def loadParam(self): - self.run_time = self.xpParam.getParam(ExperienceParameter.SIRIRUNTIME) - self.query_size = self.xpParam.getParam(ExperienceParameter.SIRIQUERYSIZE) - self.response_size = self.xpParam.getParam(ExperienceParameter.SIRIRESPONSESIZE) - self.delay_query_response = self.xpParam.getParam(ExperienceParameter.SIRIDELAYQUERYRESPONSE) - self.min_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMINPAYLOADSIZE) - self.max_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMAXPAYLOADSIZE) - self.interval_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALTIMEMS) - self.buffer_size = self.xpParam.getParam(ExperienceParameter.SIRIBUFFERSIZE) - self.burst_size = self.xpParam.getParam(ExperienceParameter.SIRIBURSTSIZE) - self.interval_burst_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALBURSTTIMEMS) - self.file = self.xpParam.getParam(ExperienceParameter.HTTPFILE) - self.random_size = self.xpParam.getParam(ExperienceParameter.HTTPRANDOMSIZE) + self.run_time = self.experience_parameter.get(ExperienceParameter.SIRIRUNTIME) + self.query_size = self.experience_parameter.get(ExperienceParameter.SIRIQUERYSIZE) + self.response_size = self.experience_parameter.get(ExperienceParameter.SIRIRESPONSESIZE) + self.delay_query_response = self.experience_parameter.get(ExperienceParameter.SIRIDELAYQUERYRESPONSE) + self.min_payload_size = self.experience_parameter.get(ExperienceParameter.SIRIMINPAYLOADSIZE) + self.max_payload_size = self.experience_parameter.get(ExperienceParameter.SIRIMAXPAYLOADSIZE) + self.interval_time_ms = self.experience_parameter.get(ExperienceParameter.SIRIINTERVALTIMEMS) + self.buffer_size = self.experience_parameter.get(ExperienceParameter.SIRIBUFFERSIZE) + self.burst_size = self.experience_parameter.get(ExperienceParameter.SIRIBURSTSIZE) + self.interval_burst_time_ms = self.experience_parameter.get(ExperienceParameter.SIRIINTERVALBURSTTIMEMS) + self.file = self.experience_parameter.get(ExperienceParameter.HTTPFILE) + self.random_size = self.experience_parameter.get(ExperienceParameter.HTTPRANDOMSIZE) def prepare(self): super(SiriHTTP, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ SiriHTTP.CLIENT_LOG) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ SiriHTTP.SERVER_LOG) - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ SiriHTTP.HTTP_CLIENT_LOG) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ SiriHTTP.HTTP_SERVER_LOG) if self.file == "random": - self.mpTopo.commandTo(self.mpConfig.client, + self.topo.command_to(self.topo_config.client, "dd if=/dev/urandom of=random bs=1K count=" + \ self.random_size) @@ -72,7 +72,7 @@ class SiriHTTP(Experience): def getSiriClientCmd(self): s = SiriHTTP.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/utils/siriClient.jar " + \ - self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \ + self.topo_config.getServerIP() + " 8080 " + 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 + \ " >" + SiriHTTP.CLIENT_LOG + " 2>" + SiriHTTP.CLIENT_ERR @@ -85,7 +85,7 @@ class SiriHTTP(Experience): return s def getHTTPClientCmd(self): - s = SiriHTTP.WGET_BIN + " http://" + self.mpConfig.getServerIP() + \ + s = SiriHTTP.WGET_BIN + " http://" + self.topo_config.getServerIP() + \ "/" + self.file + " --no-check-certificate" print(s) return s @@ -93,22 +93,22 @@ class SiriHTTP(Experience): def clean(self): super(SiriHTTP, self).clean() if self.file == "random": - self.mpTopo.commandTo(self.mpConfig.client, "rm random*") + self.topo.command_to(self.topo_config.client, "rm random*") def run(self): cmd = self.getSiriServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before") - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before") + self.topo.command_to(self.topo_config.server, cmd) cmd = self.getHTTPServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before") + self.topo.command_to(self.topo_config.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before") cmd = self.getHTTPClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, "for i in {1..200}; do " + cmd + "; done &") + self.topo.command_to(self.topo_config.client, "for i in {1..200}; do " + cmd + "; done &") cmd = self.getSiriClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, cmd) - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after") - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after") - self.mpTopo.commandTo(self.mpConfig.server, "pkill -f siri_server.py") - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_after") + self.topo.command_to(self.topo_config.server, "pkill -f siri_server.py") + self.topo.command_to(self.topo_config.client, "sleep 2") diff --git a/experiences/siri_msg.py b/experiences/siri_msg.py index 125ef0e..9ba126c 100644 --- a/experiences/siri_msg.py +++ b/experiences/siri_msg.py @@ -13,20 +13,20 @@ class SiriMsg(Experience): JAVA_BIN = "java" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(SiriMsg, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(SiriMsg, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(SiriMsg, self).classicRun() + super(SiriMsg, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ SiriMsg.PING_OUTPUT ) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -35,33 +35,33 @@ class SiriMsg(Experience): return s def loadParam(self): - self.run_time = self.xpParam.getParam(ExperienceParameter.SIRIRUNTIME) - self.query_size = self.xpParam.getParam(ExperienceParameter.SIRIQUERYSIZE) - self.response_size = self.xpParam.getParam(ExperienceParameter.SIRIRESPONSESIZE) - self.delay_query_response = self.xpParam.getParam(ExperienceParameter.SIRIDELAYQUERYRESPONSE) - self.min_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMINPAYLOADSIZE) - self.max_payload_size = self.xpParam.getParam(ExperienceParameter.SIRIMAXPAYLOADSIZE) - self.interval_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALTIMEMS) - self.buffer_size = self.xpParam.getParam(ExperienceParameter.SIRIBUFFERSIZE) - self.burst_size = self.xpParam.getParam(ExperienceParameter.SIRIBURSTSIZE) - self.interval_burst_time_ms = self.xpParam.getParam(ExperienceParameter.SIRIINTERVALBURSTTIMEMS) - self.client_sleep = self.xpParam.getParam(ExperienceParameter.MSGCLIENTSLEEP) - self.server_sleep = self.xpParam.getParam(ExperienceParameter.MSGSERVERSLEEP) - self.nb_requests = self.xpParam.getParam(ExperienceParameter.MSGNBREQUESTS) + self.run_time = self.experience_parameter.get(ExperienceParameter.SIRIRUNTIME) + self.query_size = self.experience_parameter.get(ExperienceParameter.SIRIQUERYSIZE) + self.response_size = self.experience_parameter.get(ExperienceParameter.SIRIRESPONSESIZE) + self.delay_query_response = self.experience_parameter.get(ExperienceParameter.SIRIDELAYQUERYRESPONSE) + self.min_payload_size = self.experience_parameter.get(ExperienceParameter.SIRIMINPAYLOADSIZE) + self.max_payload_size = self.experience_parameter.get(ExperienceParameter.SIRIMAXPAYLOADSIZE) + self.interval_time_ms = self.experience_parameter.get(ExperienceParameter.SIRIINTERVALTIMEMS) + self.buffer_size = self.experience_parameter.get(ExperienceParameter.SIRIBUFFERSIZE) + self.burst_size = self.experience_parameter.get(ExperienceParameter.SIRIBURSTSIZE) + self.interval_burst_time_ms = self.experience_parameter.get(ExperienceParameter.SIRIINTERVALBURSTTIMEMS) + self.client_sleep = self.experience_parameter.get(ExperienceParameter.MSGCLIENTSLEEP) + self.server_sleep = self.experience_parameter.get(ExperienceParameter.MSGSERVERSLEEP) + self.nb_requests = self.experience_parameter.get(ExperienceParameter.MSGNBREQUESTS) def prepare(self): super(SiriMsg, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ SiriMsg.CLIENT_LOG) - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ SiriMsg.CLIENT_ERR) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ SiriMsg.SERVER_LOG) - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ SiriMsg.MSG_CLIENT_LOG) - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ SiriMsg.MSG_CLIENT_ERR) - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.server, "rm " + \ SiriMsg.MSG_SERVER_LOG) def getSiriServerCmd(self): @@ -72,7 +72,7 @@ class SiriMsg(Experience): def getSiriClientCmd(self): s = SiriMsg.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/utils/siriClient.jar " + \ - self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \ + self.topo_config.getServerIP() + " 8080 " + 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 + \ " >" + SiriMsg.CLIENT_LOG + " 2>" + SiriMsg.CLIENT_ERR @@ -97,20 +97,20 @@ class SiriMsg(Experience): def run(self): cmd = self.getSiriServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before") - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_before") + self.topo.command_to(self.topo_config.server, cmd) cmd = self.getMsgServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before") + self.topo.command_to(self.topo_config.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_before") cmd = self.getMsgClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, cmd) + self.topo.command_to(self.topo_config.client, cmd) cmd = self.getSiriClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, cmd) - self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after") - self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after") - self.mpTopo.commandTo(self.mpConfig.server, "pkill -f siri_server.py") - self.mpTopo.commandTo(self.mpConfig.server, "pkill -f msg_server.py") - self.mpTopo.commandTo(self.mpConfig.server, "pkill -f msg_client.py") - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, cmd) + self.topo.command_to(self.topo_config.server, "netstat -sn > netstat_server_after") + self.topo.command_to(self.topo_config.client, "netstat -sn > netstat_client_after") + self.topo.command_to(self.topo_config.server, "pkill -f siri_server.py") + self.topo.command_to(self.topo_config.server, "pkill -f msg_server.py") + self.topo.command_to(self.topo_config.server, "pkill -f msg_client.py") + self.topo.command_to(self.topo_config.client, "sleep 2") diff --git a/experiences/vlc.py b/experiences/vlc.py index 9760cfa..de3a552 100644 --- a/experiences/vlc.py +++ b/experiences/vlc.py @@ -9,20 +9,20 @@ class VLC(Experience): VLC_BIN = "/home/mininet/vlc/vlc" PING_OUTPUT = "ping.log" - def __init__(self, xpParamFile, mpTopo, mpConfig): - super(VLC, self).__init__(xpParamFile, mpTopo, mpConfig) + def __init__(self, experience_parameter, topo, topo_config): + super(VLC, self).__init__(experience_parameter, topo, topo_config) self.loadParam() self.ping() - super(VLC, self).classicRun() + super(VLC, self).classic_run() def ping(self): - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ VLC.PING_OUTPUT ) - count = self.xpParam.getParam(ExperienceParameter.PINGCOUNT) - for i in range(0, self.mpConfig.getClientInterfaceCount()): - cmd = self.pingCommand(self.mpConfig.getClientIP(i), - self.mpConfig.getServerIP(), n = count) - self.mpTopo.commandTo(self.mpConfig.client, cmd) + count = self.experience_parameter.get(ExperienceParameter.PINGCOUNT) + for i in range(0, self.topo_config.getClientInterfaceCount()): + 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 + \ @@ -31,18 +31,18 @@ class VLC(Experience): return s def loadParam(self): - self.file = self.xpParam.getParam(ExperienceParameter.VLCFILE) - self.time = self.xpParam.getParam(ExperienceParameter.VLCTIME) + self.file = self.experience_parameter.get(ExperienceParameter.VLCFILE) + self.time = self.experience_parameter.get(ExperienceParameter.VLCTIME) def prepare(self): super(VLC, self).prepare() - self.mpTopo.commandTo(self.mpConfig.client, "rm " + \ + self.topo.command_to(self.topo_config.client, "rm " + \ VLC.CLIENT_LOG ) - self.mpTopo.commandTo(self.mpConfig.client, "Xvfb :66 &") - self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ + self.topo.command_to(self.topo_config.client, "Xvfb :66 &") + self.topo.command_to(self.topo_config.server, "rm " + \ VLC.SERVER_LOG ) if self.file == "random": - self.mpTopo.commandTo(self.mpConfig.client, + self.topo.command_to(self.topo_config.client, "dd if=/dev/urandom of=random bs=1K count=" + \ self.random_size) @@ -55,7 +55,7 @@ class VLC(Experience): s = "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/mininet/usr/lib/ && sudo ldconfig && " \ + VLC.VLC_BIN + " -I dummy --x11-display :66" + \ " --adaptive-logic 3 --no-loop --play-and-exit " + \ - " http://" + self.mpConfig.getServerIP() + \ + " http://" + self.topo_config.getServerIP() + \ "/" + self.file + " 2>&1 | grep -E '(Neb|halp|bandwidth|late|Buffering|buffering)' > " + VLC.CLIENT_LOG if self.time != "0" : s = s + " &" @@ -65,19 +65,19 @@ class VLC(Experience): def clean(self): super(VLC, self).clean(self) if self.file == "random": - self.mpTopo.commandTo(self.mpConfig.client, "rm random*") - self.mpTopo.commandTo(self.mpConfig.client, "pkill Xvfb") + self.topo.command_to(self.topo_config.client, "rm random*") + self.topo.command_to(self.topo_config.client, "pkill Xvfb") def run(self): cmd = self.getVLCServerCmd() - self.mpTopo.commandTo(self.mpConfig.server, cmd) + self.topo.command_to(self.topo_config.server, cmd) - self.mpTopo.commandTo(self.mpConfig.client, "sleep 1") + self.topo.command_to(self.topo_config.client, "sleep 1") cmd = self.getVLCClientCmd() - self.mpTopo.commandTo(self.mpConfig.client, cmd) + self.topo.command_to(self.topo_config.client, cmd) if self.time != "0" : - self.mpTopo.commandTo(self.mpConfig.client, "sleep " + self.time) - self.mpTopo.commandTo(self.mpConfig.client, "pkill -9 -f vlc") + self.topo.command_to(self.topo_config.client, "sleep " + self.time) + self.topo.command_to(self.topo_config.client, "pkill -9 -f vlc") - self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") + self.topo.command_to(self.topo_config.client, "sleep 2") diff --git a/mininet_builder.py b/mininet_builder.py index e45f711..619113a 100644 --- a/mininet_builder.py +++ b/mininet_builder.py @@ -5,40 +5,57 @@ from mininet.node import OVSBridge from mininet.cli import CLI from subprocess import Popen, PIPE +import logging + class MininetBuilder(Topo): def __init__(self): Topo.__init__( self ) self.net = None - def commandTo(self, who, cmd): + def command_to(self, who, cmd): + """ + Launch command `cmd` to the specific name space of `who` + """ return who.cmd(cmd) - def notNSCommand(self, cmd): + def command_global(self, cmd): + """ + Launch command `cmd` over the global system, i.e., not specific to a name space + """ p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) stdout, stderr = p.communicate() if stderr: + logging.error("Got error when running cmd: {}".format(cmd)) return "Error" return stdout - def startNetwork(self): + def start_network(self): + """ + Start the network using Mininet + + Note that the use of OVSBridge avoid facing issues with OVS controllers. + """ self.net = Mininet(topo=self,link=TCLink,switch=OVSBridge) self.net.start() - def getCLI(self): + def get_cli(self): + """ + Get the Mininet command line interface + """ if self.net is None: - print("Can not get the CLI") + logging.error("Cannot get the CLI") else: CLI(self.net) - def getHost(self, who): + def get_host(self, who): if self.net is None: - print("Network not available....") - raise Exception("Network not ready"); + logging.error("Network not available...") + raise Exception("Network not ready") else: return self.net.getNodeByName(who) - def stopNetwork(self): + def stop_network(self): if self.net is None: - print("Could not stop network... Nothing to stop)") + logging.warning("Unable to stop the network: net is None") else: self.net.stop() diff --git a/runner.py b/runner.py index 40a4a17..cc97a5e 100644 --- a/runner.py +++ b/runner.py @@ -8,55 +8,82 @@ from mininet_builder import MininetBuilder from experiences import EXPERIENCES from topos import TOPO_CONFIGS, TOPOS +import logging + class Runner(object): - def __init__(self, builderType, topoParamFile, xpParamFile): - self.defParamXp(xpParamFile) - self.topoParam = TopoParameter(topoParamFile) - self.defBuilder(builderType) - self.defTopo() - self.defConfig() - self.startTopo() - self.runXp() - self.stopTopo() + """ + Run an experiment described by `experience_parameter_file` in the topology + described by `topo_parameter_file` in the network environment built by + `builder_type`. - def defParamXp(self, xpParamFile): - self.xpParam = ExperienceParameter(xpParamFile) + All the operations are done when calling the constructor. + """ + def __init__(self, builder_type, topo_parameter_file, experience_parameter_file): + self.experience_parameter = ExperienceParameter(experience_parameter_file) + self.topo_parameter = TopoParameter(topo_parameter_file) + self.set_builder(builder_type) + self.set_topo() + self.set_topo_config() + self.start_topo() + self.run_experience() + self.stop_topo() - def defBuilder(self, builderType): - if builderType == Topo.mininetBuilder: - self.topoBuilder = MininetBuilder() + def set_builder(self, builder_type): + """ + Currently the only builder type supported is Mininet... + """ + if builder_type == Topo.MININET_BUILDER: + self.topo_builder = MininetBuilder() else: - raise Exception("I can not find the builder " + - builderType) - def defTopo(self): - t = self.topoParam.getParam(Topo.topoAttr) + raise Exception("I can not find the builder {}".format(builder_type)) + + def set_topo(self): + """ + Matches the name of the topo and find the corresponding Topo class. + """ + t = self.topo_parameter.get(Topo.TOPO_ATTR) if t in TOPOS: - self.Topo = TOPOS[t](self.topoBuilder, self.topoParam) + self.topo = TOPOS[t](self.topo_builder, self.topo_parameter) else: raise Exception("Unknown topo: {}".format(t)) - print(self.Topo) - def defConfig(self): - t = self.topoParam.getParam(Topo.topoAttr) + logging.info("Using topo {}".format(self.topo)) + + def set_topo_config(self): + """ + Match the name of the topo and find the corresponding TopoConfig class. + """ + t = self.topo_parameter.get(Topo.TOPO_ATTR) if t in TOPO_CONFIGS: - self.TopoConfig = TOPO_CONFIGS[t](self.Topo, self.topoParam) + self.topo_config = TOPO_CONFIGS[t](self.topo, self.topo_parameter) else: raise Exception("Unknown topo config: {}".format(t)) - def startTopo(self): - self.Topo.startNetwork() - self.TopoConfig.configureNetwork() + logging.info("Using topo config {}".format(self.topo_config)) - def runXp(self): - xp = self.xpParam.getParam(ExperienceParameter.XPTYPE) + def start_topo(self): + """ + Initialize the topology with its configuration + """ + self.topo.start_network() + self.topo_config.configure_network() + + def run_experience(self): + """ + Match the name of the experiement and launch it + """ + xp = self.experience_parameter.get(ExperienceParameter.XPTYPE) if xp in EXPERIENCES: - EXPERIENCES[xp](self.xpParam, self.Topo, self.TopoConfig) + EXPERIENCES[xp](self.experience_parameter, self.topo, self.topo_config) else: raise Exception("Unknown experience {}".format(xp)) - def stopTopo(self): - self.Topo.stopNetwork() + def stop_topo(self): + """ + Stop the topology + """ + self.topo.stop_network() if __name__ == '__main__': @@ -71,5 +98,8 @@ if __name__ == '__main__': help="path to the experience parameter file") args = parser.parse_args() + + logging.basicConfig(level=logging.INFO) + # XXX Currently, there is no alternate topo builder... - Runner(Topo.mininetBuilder, args.topo_param_file, args.experience_param_file) \ No newline at end of file + Runner(Topo.MININET_BUILDER, args.topo_param_file, args.experience_param_file) \ No newline at end of file diff --git a/topos/ecmp_single_interface.py b/topos/ecmp_single_interface.py index 4e6d3db..c742249 100644 --- a/topos/ecmp_single_interface.py +++ b/topos/ecmp_single_interface.py @@ -57,36 +57,36 @@ class ECMPSingleInterfaceConfig(TopoConfig): mask = len(self.topo.routers) - 1 for l in self.topo.routers: cmd = self.getIptableRuleICMP(mask, i) - self.topo.commandTo(self.client, cmd) - self.topo.commandTo(self.server, cmd) + self.topo.command_to(self.client, cmd) + self.topo.command_to(self.server, cmd) cmd = self.getIptableRuleTCPPortClient(mask, i) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) cmd = self.getIptableRuleTCPPortServer(mask, i) - self.topo.commandTo(self.server, cmd) + self.topo.command_to(self.server, cmd) cmd = self.getIpRuleCmd(i) - self.topo.commandTo(self.client, cmd) - self.topo.commandTo(self.server, cmd) + self.topo.command_to(self.client, cmd) + self.topo.command_to(self.server, cmd) cmd = self.getDefaultRouteCmd(self.getRouterIPClient(i), i) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) cmd = self.getDefaultRouteCmd(self.getRouterIPServer(i), i) - self.topo.commandTo(self.server, cmd) + self.topo.command_to(self.server, cmd) i = i + 1 ### cmd = self.addRouteDefaultSimple(self.getRouterIPServer(0)) - self.topo.commandTo(self.server, cmd) + self.topo.command_to(self.server, cmd) cmd = self.addRouteDefaultSimple(self.getRouterIPClient(0)) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) - self.topo.commandTo(self.client, "ip route flush cache") - self.topo.commandTo(self.server, "ip route flush cache") + self.topo.command_to(self.client, "ip route flush cache") + self.topo.command_to(self.server, "ip route flush cache") def getIptableRuleICMP(self, mask, id): s = 'iptables -t mangle -A OUTPUT -m u32 --u32 ' + \ @@ -130,56 +130,56 @@ class ECMPSingleInterfaceConfig(TopoConfig): return s def configureInterfaces(self): - self.client = self.topo.getHost(Topo.clientName) - self.server = self.topo.getHost(Topo.serverName) + self.client = self.topo.get_host(Topo.clientName) + self.server = self.topo.get_host(Topo.serverName) self.routers = [] i = 0 netmask = "255.255.255.0" for l in self.topo.routers: - self.routers.append(self.topo.getHost( + self.routers.append(self.topo.get_host( Topo.routerNamePrefix + str(i))) cmd = self.interfaceUpCommand( self.getRouterInterfaceLSwitch(i), self.getRouterIPClient(i), netmask) - self.topo.commandTo(self.routers[-1] , cmd) + self.topo.command_to(self.routers[-1] , cmd) cmd = self.interfaceUpCommand( self.getRouterInterfaceRSwitch(i), self.getRouterIPServer(i), netmask) - self.topo.commandTo(self.routers[-1] , cmd) + self.topo.command_to(self.routers[-1] , cmd) i = i + 1 cmd = self.interfaceUpCommand(self.getClientInterface(0), self.getClientIP(0), netmask) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) cmd = self.interfaceUpCommand(self.getServerInterface(), self.getServerIP(), netmask) - self.topo.commandTo(self.server, cmd) + self.topo.command_to(self.server, cmd) def getClientIP(self, interfaceID): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) clientIP = lSubnet + str(interfaceID) + ".1" return clientIP def getClientSubnet(self, interfaceID): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) clientSubnet = lSubnet + str(interfaceID) + ".0/24" return clientSubnet def getRouterIPClient(self, id): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) routerIP = lSubnet + "0." + str(id + 2) return routerIP def getRouterIPServer(self, id): - rSubnet = self.param.getParam(TopoParameter.RSUBNET) + rSubnet = self.param.get(TopoParameter.RSUBNET) routerIP = rSubnet + "0." + str(id + 2) return routerIP def getServerIP(self): - rSubnet = self.param.getParam(TopoParameter.RSUBNET) + rSubnet = self.param.get(TopoParameter.RSUBNET) serverIP = rSubnet + "0.1" return serverIP diff --git a/topos/multi_interface.py b/topos/multi_interface.py index 58525da..fd0c1f7 100644 --- a/topos/multi_interface.py +++ b/topos/multi_interface.py @@ -54,31 +54,31 @@ class MultiInterfaceConfig(TopoConfig): i = 0 for l in self.topo.switchClient: cmd = self.addRouteTableCommand(self.getClientIP(i), i) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) cmd = self.addRouteScopeLinkCommand( self.getClientSubnet(i), self.getClientInterface(i), i) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) cmd = self.addRouteDefaultCommand(self.getRouterIPSwitch(i), i) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) i = i + 1 cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0), self.getClientInterface(0)) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) cmd = self.addRouteDefaultSimple(self.getRouterIPServer()) - self.topo.commandTo(self.server, cmd) + self.topo.command_to(self.server, cmd) def configureInterfaces(self): print("Configure interfaces for multi inf") - self.client = self.topo.getHost(Topo.clientName) - self.server = self.topo.getHost(Topo.serverName) - self.router = self.topo.getHost(Topo.routerName) + self.client = self.topo.get_host(Topo.clientName) + self.server = self.topo.get_host(Topo.serverName) + self.router = self.topo.get_host(Topo.routerName) i = 0 netmask = "255.255.255.0" links = self.topo.getLinkCharacteristics() @@ -86,14 +86,14 @@ class MultiInterfaceConfig(TopoConfig): cmd = self.interfaceUpCommand( self.getClientInterface(i), self.getClientIP(i), netmask) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) clientIntfMac = self.client.intf(self.getClientInterface(i)).MAC() - self.topo.commandTo(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac) + self.topo.command_to(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac) if(links[i].back_up): cmd = self.interfaceBUPCommand( self.getClientInterface(i)) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) i = i + 1 @@ -102,46 +102,46 @@ class MultiInterfaceConfig(TopoConfig): cmd = self.interfaceUpCommand( self.getRouterInterfaceSwitch(i), self.getRouterIPSwitch(i), netmask) - self.topo.commandTo(self.router, cmd) + self.topo.command_to(self.router, cmd) routerIntfMac = self.router.intf(self.getRouterInterfaceSwitch(i)).MAC() - self.topo.commandTo(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) + self.topo.command_to(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) print(str(links[i])) i = i + 1 cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(), self.getRouterIPServer(), netmask) - self.topo.commandTo(self.router, cmd) + self.topo.command_to(self.router, cmd) routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC() - self.topo.commandTo(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac) + self.topo.command_to(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac) cmd = self.interfaceUpCommand(self.getServerInterface(), self.getServerIP(), netmask) - self.topo.commandTo(self.server, cmd) + self.topo.command_to(self.server, cmd) serverIntfMac = self.server.intf(self.getServerInterface()).MAC() - self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac) + self.topo.command_to(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac) def getClientIP(self, interfaceID): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) clientIP = lSubnet + str(interfaceID) + ".1" return clientIP def getClientSubnet(self, interfaceID): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) clientSubnet = lSubnet + str(interfaceID) + ".0/24" return clientSubnet def getRouterIPSwitch(self, interfaceID): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) routerIP = lSubnet + str(interfaceID) + ".2" return routerIP def getRouterIPServer(self): - rSubnet = self.param.getParam(TopoParameter.RSUBNET) + rSubnet = self.param.get(TopoParameter.RSUBNET) routerIP = rSubnet + "0.2" return routerIP def getServerIP(self): - rSubnet = self.param.getParam(TopoParameter.RSUBNET) + rSubnet = self.param.get(TopoParameter.RSUBNET) serverIP = rSubnet + "0.1" return serverIP diff --git a/topos/multi_interface_cong.py b/topos/multi_interface_cong.py index 756e273..f6e4c1f 100644 --- a/topos/multi_interface_cong.py +++ b/topos/multi_interface_cong.py @@ -65,30 +65,30 @@ class MultiInterfaceCongConfig(TopoConfig): i = 0 for l in self.topo.switch: cmd = self.addRouteTableCommand(self.getClientIP(i), i) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) # Congestion client cmd = self.addRouteTableCommand(self.getCongClientIP(i), i) - self.topo.commandTo(self.cong_clients[i], cmd) + self.topo.command_to(self.cong_clients[i], cmd) cmd = self.addRouteScopeLinkCommand( self.getClientSubnet(i), self.getClientInterface(i), i) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) # Congestion client cmd = self.addRouteScopeLinkCommand( self.getClientSubnet(i), self.getCongClientInterface(i), i) - self.topo.commandTo(self.cong_clients[i], cmd) + self.topo.command_to(self.cong_clients[i], cmd) cmd = self.addRouteDefaultCommand(self.getRouterIPSwitch(i), i) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) # Congestion client # Keep the same command - self.topo.commandTo(self.cong_clients[i], cmd) + self.topo.command_to(self.cong_clients[i], cmd) # Congestion client cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(i), @@ -97,40 +97,40 @@ class MultiInterfaceCongConfig(TopoConfig): cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0), self.getClientInterface(0)) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) # Congestion Client i = 0 for c in self.cong_clients: cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(i), self.getCongClientInterface(i)) - self.topo.commandTo(c, cmd) + self.topo.command_to(c, cmd) i = i + 1 cmd = self.addRouteDefaultSimple(self.getRouterIPServer()) - self.topo.commandTo(self.server, cmd) + self.topo.command_to(self.server, cmd) # Congestion servers i = 0 for s in self.cong_servers: cmd = self.addRouteDefaultSimple(self.getRouterIPCongServer(i)) - self.topo.commandTo(s, cmd) + self.topo.command_to(s, cmd) i += 1 def configureInterfaces(self): print("Configure interfaces for multi inf") - self.client = self.topo.getHost(Topo.clientName) - self.server = self.topo.getHost(Topo.serverName) - self.router = self.topo.getHost(Topo.routerName) + self.client = self.topo.get_host(Topo.clientName) + self.server = self.topo.get_host(Topo.serverName) + self.router = self.topo.get_host(Topo.routerName) cong_client_names = self.topo.getCongClients() self.cong_clients = [] for cn in cong_client_names: - self.cong_clients.append(self.topo.getHost(cn)) + self.cong_clients.append(self.topo.get_host(cn)) cong_server_names = self.topo.getCongServers() self.cong_servers = [] for sn in cong_server_names: - self.cong_servers.append(self.topo.getHost(sn)) + self.cong_servers.append(self.topo.get_host(sn)) i = 0 netmask = "255.255.255.0" @@ -139,99 +139,99 @@ class MultiInterfaceCongConfig(TopoConfig): cmd = self.interfaceUpCommand( self.getClientInterface(i), self.getClientIP(i), netmask) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) clientIntfMac = self.client.intf(self.getClientInterface(i)).MAC() - self.topo.commandTo(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac) + self.topo.command_to(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac) if(links[i].back_up): cmd = self.interfaceBUPCommand( self.getClientInterface(i)) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) # Congestion client cmd = self.interfaceUpCommand( self.getCongClientInterface(i), self.getCongClientIP(i), netmask) - self.topo.commandTo(self.cong_clients[i], cmd) + self.topo.command_to(self.cong_clients[i], cmd) congClientIntfMac = self.cong_clients[i].intf(self.getCongClientInterface(i)).MAC() - self.topo.commandTo(self.router, "arp -s " + self.getCongClientIP(i) + " " + congClientIntfMac) + self.topo.command_to(self.router, "arp -s " + self.getCongClientIP(i) + " " + congClientIntfMac) cmd = self.interfaceUpCommand( self.getRouterInterfaceSwitch(i), self.getRouterIPSwitch(i), netmask) - self.topo.commandTo(self.router, cmd) + self.topo.command_to(self.router, cmd) routerIntfMac = self.router.intf(self.getRouterInterfaceSwitch(i)).MAC() - self.topo.commandTo(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) + self.topo.command_to(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) # Don't forget the congestion client - self.topo.commandTo(self.cong_clients[i], "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) + self.topo.command_to(self.cong_clients[i], "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) print(str(links[i])) i = i + 1 cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(), self.getRouterIPServer(), netmask) - self.topo.commandTo(self.router, cmd) + self.topo.command_to(self.router, cmd) routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC() - self.topo.commandTo(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac) + self.topo.command_to(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac) cmd = self.interfaceUpCommand(self.getServerInterface(), self.getServerIP(), netmask) - self.topo.commandTo(self.server, cmd) + self.topo.command_to(self.server, cmd) serverIntfMac = self.server.intf(self.getServerInterface()).MAC() - self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac) + 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), self.getRouterIPCongServer(i), netmask) - self.topo.commandTo(self.router, cmd) + self.topo.command_to(self.router, cmd) routerIntfMac = self.router.intf(self.getRouterInterfaceCongServer(i)).MAC() - self.topo.commandTo(s, "arp -s " + self.getRouterIPCongServer(i) + " " + routerIntfMac) + self.topo.command_to(s, "arp -s " + self.getRouterIPCongServer(i) + " " + routerIntfMac) cmd = self.interfaceUpCommand(self.getCongServerInterface(i), self.getCongServerIP(i), netmask) - self.topo.commandTo(s, cmd) + self.topo.command_to(s, cmd) congServerIntfMac = s.intf(self.getCongServerInterface(i)).MAC() - self.topo.commandTo(self.router, "arp -s " + self.getCongServerIP(i) + " " + congServerIntfMac) + self.topo.command_to(self.router, "arp -s " + self.getCongServerIP(i) + " " + congServerIntfMac) i = i + 1 def getClientIP(self, interfaceID): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) clientIP = lSubnet + str(interfaceID) + ".1" return clientIP def getCongClientIP(self, interfaceID): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) congClientIP = lSubnet + str(interfaceID) + ".127" return congClientIP def getClientSubnet(self, interfaceID): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) clientSubnet = lSubnet + str(interfaceID) + ".0/24" return clientSubnet def getRouterIPSwitch(self, interfaceID): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) routerIP = lSubnet + str(interfaceID) + ".2" return routerIP def getRouterIPServer(self): - rSubnet = self.param.getParam(TopoParameter.RSUBNET) + rSubnet = self.param.get(TopoParameter.RSUBNET) routerIP = rSubnet + "0.2" return routerIP def getRouterIPCongServer(self, congID): - rSubnet = self.param.getParam(TopoParameter.RSUBNET) + rSubnet = self.param.get(TopoParameter.RSUBNET) routerIP = rSubnet + str(1 + congID) + ".2" return routerIP def getServerIP(self): - rSubnet = self.param.getParam(TopoParameter.RSUBNET) + rSubnet = self.param.get(TopoParameter.RSUBNET) serverIP = rSubnet + "0.1" return serverIP def getCongServerIP(self, congID): - rSubnet = self.param.getParam(TopoParameter.RSUBNET) + rSubnet = self.param.get(TopoParameter.RSUBNET) serverIP = rSubnet + str(1 + congID) + ".1" return serverIP diff --git a/topos/two_interface_congestion.py b/topos/two_interface_congestion.py index e24e833..f9f26a2 100644 --- a/topos/two_interface_congestion.py +++ b/topos/two_interface_congestion.py @@ -67,83 +67,83 @@ class TwoInterfaceCongestionConfig(TopoConfig): def configureRoute(self): # Client - Router cmd = self.addRouteTableCommand("10.0.0.1", 0) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) cmd = self.addRouteScopeLinkCommand("10.0.0.0/24", Topo.clientName + "-eth0", 0) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) cmd = self.addRouteDefaultCommand("10.0.0.2", 0) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) # Client -> Router cong cmd = self.addRouteTableCommand("10.0.1.1", 1) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) cmd = self.addRouteScopeLinkCommand("10.0.1.0/24", Topo.clientName + "-eth1", 1) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) cmd = self.addRouteDefaultCommand("10.0.1.2", 1) - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) # Client cong -> Router cong cmd = self.addRouteTableCommand("10.0.2.1", 0) - self.topo.commandTo(self.clientCong, cmd) + self.topo.command_to(self.clientCong, cmd) cmd = self.addRouteScopeLinkCommand("10.0.2.0/24", Topo.clientName + "Cong-eth0", 0) - self.topo.commandTo(self.clientCong, cmd) + self.topo.command_to(self.clientCong, cmd) cmd = self.addRouteDefaultCommand("10.0.2.2", 0) - self.topo.commandTo(self.clientCong, cmd) + self.topo.command_to(self.clientCong, cmd) # Router cong -> Router cmd = self.addRouteTableCommand("10.0.3.1", 0) - self.topo.commandTo(self.routerCong, cmd) + self.topo.command_to(self.routerCong, cmd) cmd = self.addRouteScopeLinkCommand("10.1.0.0/16", Topo.routerName + "Cong-eth2", 0) - self.topo.commandTo(self.routerCong, cmd) + self.topo.command_to(self.routerCong, cmd) cmd = self.addRouteDefaultCommand("10.0.3.2", 0) - self.topo.commandTo(self.routerCong, cmd) + self.topo.command_to(self.routerCong, cmd) # Router -> Router cong cmd = self.addRouteTableCommand("10.0.3.2", 0) - self.topo.commandTo(self.router, cmd) + self.topo.command_to(self.router, cmd) cmd = self.addRouteScopeLinkCommand("10.0.0.0/16", Topo.routerName + "-eth1", 0) - self.topo.commandTo(self.router, cmd) + self.topo.command_to(self.router, cmd) cmd = self.addRouteDefaultCommand("10.0.3.1", 0) - self.topo.commandTo(self.router, cmd) + self.topo.command_to(self.router, cmd) # Default route Client cmd = self.addRouteDefaultGlobalCommand("10.0.0.2", Topo.clientName + "-eth0") - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) # Default route Client cong cmd = self.addRouteDefaultGlobalCommand("10.0.2.2", Topo.clientName + "Cong-eth0") - self.topo.commandTo(self.clientCong, cmd) + self.topo.command_to(self.clientCong, cmd) # Default route Router cong cmd = self.addRouteDefaultGlobalCommand("10.0.3.2", Topo.routerName + "Cong-eth2") - self.topo.commandTo(self.routerCong, cmd) + self.topo.command_to(self.routerCong, cmd) # Default route Router cmd = self.addRouteDefaultGlobalCommand("10.0.3.1", Topo.routerName + "-eth1") - self.topo.commandTo(self.router, cmd) + self.topo.command_to(self.router, cmd) # Default route Server cmd = self.addRouteDefaultGlobalCommand("10.1.0.2", Topo.serverName + "-eth0") - self.topo.commandTo(self.server, cmd) + self.topo.command_to(self.server, cmd) # Default route Server cong cmd = self.addRouteDefaultGlobalCommand("10.1.1.2", Topo.serverName + "Cong-eth0") - self.topo.commandTo(self.serverCong, cmd) + self.topo.command_to(self.serverCong, cmd) def configureInterface(self, srcHost, dstHost, srcInterfaceName, srcIP, netmask): cmd = self.interfaceUpCommand(srcInterfaceName, srcIP, netmask) - self.topo.commandTo(srcHost, cmd) + self.topo.command_to(srcHost, cmd) mac = srcHost.intf(srcInterfaceName).MAC() cmd = self.arpCommand(srcIP, mac) - self.topo.commandTo(dstHost, cmd) + self.topo.command_to(dstHost, cmd) def configureInterfaces(self): print("Configure interfaces for two inf cong") - self.client = self.topo.getHost(Topo.clientName) - self.clientCong = self.topo.getHost(Topo.clientName + "Cong") - self.server = self.topo.getHost(Topo.serverName) - self.serverCong = self.topo.getHost(Topo.serverName + "Cong") - self.router = self.topo.getHost(Topo.routerName) - self.routerCong = self.topo.getHost(Topo.routerName + "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") netmask = "255.255.255.0" links = self.topo.getLinkCharacteristics() @@ -152,7 +152,7 @@ class TwoInterfaceCongestionConfig(TopoConfig): if(links[0].back_up): cmd = self.interfaceBUPCommand(Topo.clientName + "-eth0") - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) self.configureInterface(self.router, self.client, Topo.routerName + "-eth0", "10.0.0.2", netmask) print(str(links[0])) @@ -162,7 +162,7 @@ class TwoInterfaceCongestionConfig(TopoConfig): if(links[1].back_up): cmd = self.interfaceBUPCommand(Topo.clientName + "-eth1") - self.topo.commandTo(self.client, cmd) + self.topo.command_to(self.client, cmd) self.configureInterface(self.routerCong, self.client, Topo.routerName + "Cong-eth0", "10.0.1.2", netmask) @@ -185,37 +185,37 @@ class TwoInterfaceCongestionConfig(TopoConfig): self.configureInterface(self.router, self.serverCong, Topo.routerName + "-eth3", "10.1.1.2", netmask) def getClientIP(self, interfaceID): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) clientIP = lSubnet + str(interfaceID) + ".1" return clientIP def getClientSubnet(self, interfaceID): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) clientSubnet = lSubnet + str(interfaceID) + ".0/24" return clientSubnet def getClientCongIP(self): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) clientIP = lSubnet + str(2) + ".1" return clientIP def getClientCongSubnet(self, interfaceID): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) clientSubnet = lSubnet + str(128) + ".0/24" return clientSubnet def getRouterIPSwitch(self, interfaceID): - lSubnet = self.param.getParam(TopoParameter.LSUBNET) + lSubnet = self.param.get(TopoParameter.LSUBNET) routerIP = lSubnet + str(interfaceID) + ".2" return routerIP def getRouterIPServer(self): - rSubnet = self.param.getParam(TopoParameter.RSUBNET) + rSubnet = self.param.get(TopoParameter.RSUBNET) routerIP = rSubnet + "0.2" return routerIP def getServerIP(self): - rSubnet = self.param.getParam(TopoParameter.RSUBNET) + rSubnet = self.param.get(TopoParameter.RSUBNET) serverIP = rSubnet + "0.1" return serverIP