From ff8d8c5537a66f2fe69d49bf70ec371dfb542463 Mon Sep 17 00:00:00 2001 From: Benjamin Hesmans Date: Thu, 26 Feb 2015 17:43:45 +0100 Subject: [PATCH] Remove white spaces... for f in `ls *.py`; do sed -i -e 's/\s\+$//' $f; done --- src/mpConfig.py | 4 ++-- src/mpECMPSingleInterfaceConfig.py | 20 ++++++++++---------- src/mpECMPSingleInterfaceTopo.py | 6 +++--- src/mpExperience.py | 4 ++-- src/mpExperienceNCPV.py | 14 +++++++------- src/mpExperiencePing.py | 6 +++--- src/mpLinkCharacteristics.py | 6 +++--- src/mpMininetBuilder.py | 6 +++--- src/mpMultiInterfaceConfig.py | 18 +++++++++--------- src/mpParam.py | 2 +- src/mpParamTopo.py | 6 +++--- src/mpParamXp.py | 2 +- src/mpTopo.py | 2 +- src/mpXpRunner.py | 8 ++++---- 14 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/mpConfig.py b/src/mpConfig.py index 315fa85..ec6900a 100644 --- a/src/mpConfig.py +++ b/src/mpConfig.py @@ -1,5 +1,5 @@ class MpConfig: - + PING_OUTPUT = "ping.log" def __init__(self, topo, param): @@ -63,7 +63,7 @@ class MpConfig: s = "ip route add default via " + via print(s) return s - + def pingCommand(self, fromIP, toIP, n=5): s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ " >> " + MpConfig.PING_OUTPUT diff --git a/src/mpECMPSingleInterfaceConfig.py b/src/mpECMPSingleInterfaceConfig.py index 74c9886..215b4bf 100644 --- a/src/mpECMPSingleInterfaceConfig.py +++ b/src/mpECMPSingleInterfaceConfig.py @@ -24,23 +24,23 @@ class MpECMPSingleInterfaceConfig(MpConfig): cmd = self.getIpRuleCmd(i) self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.server, cmd) - + cmd = self.getDefaultRouteCmd(self.getRouterIPClient(i), i) self.topo.commandTo(self.client, cmd) cmd = self.getDefaultRouteCmd(self.getRouterIPServer(i), i) self.topo.commandTo(self.server, cmd) - + i = i + 1 - + ### cmd = self.addRouteDefaultSimple(self.getRouterIPServer(0)) self.topo.commandTo(self.server, cmd) - + cmd = self.addRouteDefaultSimple(self.getRouterIPClient(0)) self.topo.commandTo(self.client, cmd) - + self.topo.commandTo(self.client, "ip route flush cache") self.topo.commandTo(self.server, "ip route flush cache") @@ -63,7 +63,7 @@ class MpECMPSingleInterfaceConfig(MpConfig): '" -j MARK --set-mark ' + str(id + 1) print (s) return s - + def getIptableRuleTCPPortServer(self, mask, id): s = 'iptables -t mangle -A OUTPUT -m u32 --u32 ' + \ '"6&0xFF=0x6 && ' + \ @@ -98,7 +98,7 @@ class MpECMPSingleInterfaceConfig(MpConfig): self.getRouterInterfaceLSwitch(i), self.getRouterIPClient(i), netmask) self.topo.commandTo(self.routers[-1] , cmd) - + cmd = self.interfaceUpCommand( self.getRouterInterfaceRSwitch(i), self.getRouterIPServer(i), netmask) @@ -109,7 +109,7 @@ class MpECMPSingleInterfaceConfig(MpConfig): cmd = self.interfaceUpCommand(self.getClientInterface(0), self.getClientIP(0), netmask) self.topo.commandTo(self.client, cmd) - + cmd = self.interfaceUpCommand(self.getServerInterface(), self.getServerIP(), netmask) self.topo.commandTo(self.server, cmd) @@ -133,7 +133,7 @@ class MpECMPSingleInterfaceConfig(MpConfig): rSubnet = self.param.getParam(MpParamTopo.RSUBNET) routerIP = rSubnet + "0." + str(id + 2) return routerIP - + def getServerIP(self): rSubnet = self.param.getParam(MpParamTopo.RSUBNET) serverIP = rSubnet + "0.1" @@ -150,7 +150,7 @@ class MpECMPSingleInterfaceConfig(MpConfig): def getClientInterface(self, interfaceID): return MpTopo.clientName + "-eth" + str(interfaceID) - + def getServerInterface(self): return MpTopo.serverName + "-eth0" diff --git a/src/mpECMPSingleInterfaceTopo.py b/src/mpECMPSingleInterfaceTopo.py index 9acb60d..d18f246 100644 --- a/src/mpECMPSingleInterfaceTopo.py +++ b/src/mpECMPSingleInterfaceTopo.py @@ -3,14 +3,14 @@ from mpTopo import MpTopo class MpECMPSingleInterfaceTopo(MpTopo): def __init__(self, topoBuilder, parameterFile): MpTopo.__init__(self,topoBuilder, parameterFile) - + print("Hello ECMP topo") - + self.client = self.addHost(MpTopo.clientName) self.server = self.addHost(MpTopo.serverName) self.lswitch = self.addSwitch(MpTopo.switchNamePrefix + "0") self.rswitch = self.addSwitch(MpTopo.switchNamePrefix + "1") - + self.addLink( self.client, self.lswitch) self.addLink( self.server, self.rswitch) diff --git a/src/mpExperience.py b/src/mpExperience.py index f996107..ac50778 100644 --- a/src/mpExperience.py +++ b/src/mpExperience.py @@ -8,12 +8,12 @@ class MpExperience: self.mpTopo = mpTopo self.mpConfig = mpConfig print(self.xpParam) - + def classicRun(self): self.prepare() self.run() self.clean() - + def prepare(self): self.setupSysctl() self.runUserspacePM() diff --git a/src/mpExperienceNCPV.py b/src/mpExperienceNCPV.py index 9c4c677..4b984ba 100644 --- a/src/mpExperienceNCPV.py +++ b/src/mpExperienceNCPV.py @@ -2,7 +2,7 @@ from mpExperience import MpExperience from mpParamXp import MpParamXp from mpPvAt import MpPvAt -class MpExperienceNCPV(MpExperience): +class MpExperienceNCPV(MpExperience): """ NC PV : NetCat and Pipe Viewer """ @@ -15,7 +15,7 @@ class MpExperienceNCPV(MpExperience): MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) self.loadParam() MpExperience.classicRun(self) - + def loadParam(self): self.pvg = self.xpParam.getParam(MpParamXp.PVG) self.pvz = self.xpParam.getParam(MpParamXp.PVZ) @@ -50,8 +50,8 @@ class MpExperienceNCPV(MpExperience): o = MpPvAt(float(tab[0]), tab[1]) self.addPvAt(o) else: - print("pv wrong line : " + n) - + print("pv wrong line : " + n) + def addPvAt(self, p): if len(self.changePvAt) == 0 : p.delta = p.at @@ -119,19 +119,19 @@ class MpExperienceNCPV(MpExperience): for i in range(0, len(self.ncClientPort)): cmd = self.getNCServerCmd(i) self.mpTopo.commandTo(self.mpConfig.server, cmd) - + cmd = self.getNCClientCmd(i) self.mpConfig.client.sendCmd(cmd) cmd = self.getPvPidCmd() self.pvPid = self.mpTopo.commandTo(self.mpConfig.server, cmd)[:-1] - + cmd = self.getPvChangeCmd() print(cmd) self.mpTopo.commandTo(self.mpConfig.server, cmd) self.mpConfig.client.waitOutput() - + self.mpTopo.commandTo(self.mpConfig.client, "sleep 1") diff --git a/src/mpExperiencePing.py b/src/mpExperiencePing.py index b86c4b5..3e84be2 100644 --- a/src/mpExperiencePing.py +++ b/src/mpExperiencePing.py @@ -1,16 +1,16 @@ from mpExperience import MpExperience from mpParamXp import MpParamXp -class MpExperiencePing(MpExperience): +class MpExperiencePing(MpExperience): PING_OUTPUT = "ping.log" def __init__(self, xpParamFile, mpTopo, mpConfig): MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig) - MpExperience.classicRun(self) + MpExperience.classicRun(self) def prepapre(self): MpExperience.prepare(self) - + def clean(self): MpExperience.clean(self) diff --git a/src/mpLinkCharacteristics.py b/src/mpLinkCharacteristics.py index b13fa38..b4e81fa 100644 --- a/src/mpLinkCharacteristics.py +++ b/src/mpLinkCharacteristics.py @@ -25,13 +25,13 @@ class MpLinkCharacteristics: print("Do not take into account " + n.__str__() + \ "because ooo !") pass - + def buildNetemCmd(self, ifname): cmd = "" for n in self.netemAt: cmd = cmd + "sleep " + str(n.delta) cmd = cmd + " && " - cmd = cmd + " tc qdisc change dev " + ifname + " " + cmd = cmd + " tc qdisc change dev " + ifname + " " cmd = cmd + " parent " + MpLinkCharacteristics.tcNetemParent cmd = cmd + " handle " + MpLinkCharacteristics.tcNetemHandle cmd = cmd + " netem " + n.cmd + " && " @@ -53,4 +53,4 @@ class MpLinkCharacteristics: for l in self.netemAt: s = s + "\t" + l.__str__() + "\n" return s - + diff --git a/src/mpMininetBuilder.py b/src/mpMininetBuilder.py index 764e254..63bc0da 100644 --- a/src/mpMininetBuilder.py +++ b/src/mpMininetBuilder.py @@ -8,7 +8,7 @@ class MpMininetBuilder(Topo): def __init__(self): Topo.__init__( self ) self.net = None - + def commandTo(self, who, cmd): return who.cmd(cmd) @@ -18,7 +18,7 @@ class MpMininetBuilder(Topo): if stderr: return "Error" return stdout - + def startNetwork(self): self.net = Mininet(topo=self,link=TCLink) self.net.start() @@ -35,7 +35,7 @@ class MpMininetBuilder(Topo): raise Exception("Network not ready"); else: return self.net.getNodeByName(who) - + def stopNetwork(self): if self.net is None: print("Could not stop network... Nothing to stop)") diff --git a/src/mpMultiInterfaceConfig.py b/src/mpMultiInterfaceConfig.py index adfde2a..701462b 100644 --- a/src/mpMultiInterfaceConfig.py +++ b/src/mpMultiInterfaceConfig.py @@ -12,7 +12,7 @@ class MpMultiInterfaceConfig(MpConfig): for l in self.topo.switch: cmd = self.addRouteTableCommand(self.getClientIP(i), i) self.topo.commandTo(self.client, cmd) - + cmd = self.addRouteScopeLinkCommand( self.getClientSubnet(i), self.getClientInterface(i), i) @@ -22,7 +22,7 @@ class MpMultiInterfaceConfig(MpConfig): i) self.topo.commandTo(self.client, cmd) i = i + 1 - + cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0), self.getClientInterface(0)) self.topo.commandTo(self.client, cmd) @@ -30,7 +30,7 @@ class MpMultiInterfaceConfig(MpConfig): cmd = self.addRouteDefaultSimple(self.getRouterIPServer()) self.topo.commandTo(self.server, cmd) - + def configureInterfaces(self): print("Configure interfaces for multi inf") self.client = self.topo.getHost(MpTopo.clientName) @@ -43,17 +43,17 @@ class MpMultiInterfaceConfig(MpConfig): self.getClientInterface(i), self.getClientIP(i), netmask) self.topo.commandTo(self.client, cmd) - + cmd = self.interfaceUpCommand( self.getRouterInterfaceSwitch(i), self.getRouterIPSwitch(i), netmask) self.topo.commandTo(self.router, cmd) i = i + 1 - + cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(), self.getRouterIPServer(), netmask) self.topo.commandTo(self.router, cmd) - + cmd = self.interfaceUpCommand(self.getServerInterface(), self.getServerIP(), netmask) self.topo.commandTo(self.server, cmd) @@ -77,7 +77,7 @@ class MpMultiInterfaceConfig(MpConfig): rSubnet = self.param.getParam(MpParamTopo.RSUBNET) routerIP = rSubnet + "0.2" return routerIP - + def getServerIP(self): rSubnet = self.param.getParam(MpParamTopo.RSUBNET) serverIP = rSubnet + "0.1" @@ -94,7 +94,7 @@ class MpMultiInterfaceConfig(MpConfig): def getRouterInterfaceSwitch(self, interfaceID): return MpTopo.routerName + "-eth" + str(interfaceID) - + def getServerInterface(self): return MpTopo.serverName + "-eth0" @@ -103,7 +103,7 @@ class MpMultiInterfaceConfig(MpConfig): def getMidRightName(self, id): return MpTopo.routerName - + def getMidL2RInterface(self, id): return self.getMidLeftName(id) + "-eth2" diff --git a/src/mpParam.py b/src/mpParam.py index c6a42ac..3f34a58 100644 --- a/src/mpParam.py +++ b/src/mpParam.py @@ -7,7 +7,7 @@ class MpParam: print("default param...") else: self.loadParamFile(paramFile) - + def loadParamFile(self, paramFile): f = open(paramFile) i = 0 diff --git a/src/mpParamTopo.py b/src/mpParamTopo.py index ff49f3a..9f96320 100644 --- a/src/mpParamTopo.py +++ b/src/mpParamTopo.py @@ -31,7 +31,7 @@ class MpParamTopo(MpParam): val = [] val.append(tmp) self.loadNetemAtList(i, val) - + def loadNetemAtList(self, id, nlist): for n in nlist: tab = n.split(",") @@ -44,9 +44,9 @@ class MpParamTopo(MpParam): else: print("Netem wrong line : " + n) print(self.linkCharacteristics[id].netemAt) - + def loadLinkCharacteristics(self): - i = 0 + i = 0 for k in sorted(self.paramDic): if k.startswith("path"): tab = self.paramDic[k].split(",") diff --git a/src/mpParamXp.py b/src/mpParamXp.py index d7292e1..19cf5a9 100644 --- a/src/mpParamXp.py +++ b/src/mpParamXp.py @@ -64,7 +64,7 @@ class MpParamXp(MpParam): def __init__(self, paramFile): MpParam.__init__(self, paramFile) - + def getParam(self, key): val = MpParam.getParam(self, key) if val is None: diff --git a/src/mpTopo.py b/src/mpTopo.py index 2537f24..5e4b48c 100644 --- a/src/mpTopo.py +++ b/src/mpTopo.py @@ -50,7 +50,7 @@ class MpTopo: def startNetwork(self): self.topoBuilder.startNetwork() - + def closeLogFile(self): self.logFile.close() diff --git a/src/mpXpRunner.py b/src/mpXpRunner.py index a8fcabd..7cdd1d6 100644 --- a/src/mpXpRunner.py +++ b/src/mpXpRunner.py @@ -20,7 +20,7 @@ class MpXpRunner: self.startTopo() self.runXp() self.stopTopo() - + def defParamXp(self, xpParamFile): self.xpParam = MpParamXp(xpParamFile) @@ -28,7 +28,7 @@ class MpXpRunner: if builderType == MpTopo.mininetBuilder: self.topoBuilder = MpMininetBuilder() else: - raise Exception("I can not find the builder " + + raise Exception("I can not find the builder " + builderType) def defTopo(self): t = self.topoParam.getParam(MpTopo.topoAttr) @@ -53,7 +53,7 @@ class MpXpRunner: self.mpTopo, self.topoParam) else: - raise Exception("Unfound Topo" + t) + raise Exception("Unfound Topo" + t) def startTopo(self): self.mpTopo.startNetwork() @@ -71,6 +71,6 @@ class MpXpRunner: self.mpTopo.getCLI() else: print("Unfound xp type..." + xp) - + def stopTopo(self): self.mpTopo.stopNetwork()