From 9f2ce22e9630800b3621ca0b545e2bedd7ce484c Mon Sep 17 00:00:00 2001 From: Benjamin Hesmans Date: Wed, 7 Jan 2015 16:00:15 +0100 Subject: [PATCH] wip add test to check if up and delay is ok test example: sudo ./mpPerf.py -f conf/topo/1_para_3 Signed-off-by: Benjamin Hesmans --- src/mpConfig.py | 10 +++++++++- src/mpMultiInterfaceConfig.py | 9 +++++++++ src/mpParamTopo.py | 2 +- src/mpPerf.py | 1 + 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/mpConfig.py b/src/mpConfig.py index d0b7832..1888324 100644 --- a/src/mpConfig.py +++ b/src/mpConfig.py @@ -1,4 +1,7 @@ class MpConfig: + + PING_OUTPUT = "ping.log" + def __init__(self, topo, param): self.topo = topo self.param = param @@ -35,4 +38,9 @@ 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 + print(s) + return s diff --git a/src/mpMultiInterfaceConfig.py b/src/mpMultiInterfaceConfig.py index 4de1a39..7c05f03 100644 --- a/src/mpMultiInterfaceConfig.py +++ b/src/mpMultiInterfaceConfig.py @@ -97,3 +97,12 @@ class MpMultiInterfaceConfig(MpConfig): def getServerInterface(self): return MpTopo.serverName + "-eth0" + + def pingAllFromClient(self, n = 5): + i = 0 + self.topo.commandTo(self.client, "rm " + MpConfig.PING_OUTPUT) + for l in self.topo.switch: + cmd = self.pingCommand(self.getClientIP(i), + self.getServerIP(), n) + self.topo.commandTo(self.client, cmd) + i = i + 1 diff --git a/src/mpParamTopo.py b/src/mpParamTopo.py index 0daa592..120d880 100644 --- a/src/mpParamTopo.py +++ b/src/mpParamTopo.py @@ -34,7 +34,7 @@ class MpParamTopo: def loadLinkCharacteristics(self): i = 0 - for k in self.paramDic: + for k in sorted(self.paramDic): if k.startswith("path"): tab = self.paramDic[k].split(",") if len(tab) == 3: diff --git a/src/mpPerf.py b/src/mpPerf.py index 1a6387b..7e24353 100755 --- a/src/mpPerf.py +++ b/src/mpPerf.py @@ -42,6 +42,7 @@ if __name__ == '__main__': mpConfig = MpMultiInterfaceConfig(mpTopo, param) mpTopo.startNetwork() mpConfig.configureNetwork() + mpConfig.pingAllFromClient() mpTopo.getCLI() mpTopo.stopNetwork() else: