Signed-off-by: Benjamin Hesmans <benjamin.hesmans@uclouvain.be>
This commit is contained in:
Benjamin Hesmans 2015-01-14 11:46:33 +01:00
parent b3c3cbf522
commit 88e92a76d6
2 changed files with 11 additions and 8 deletions

View File

@ -26,22 +26,19 @@ class MpECMPSingleInterfaceTopo(MpTopo):
str(link.id))
def __str__(self):
s = "Single if ECMP like env"
"""
s = "Single if ECMP like env\n"
i = 0
n = len(self.topoParam.linkCharacteristics)
for p in self.topoParam.linkCharacteristics:
if i == n // 2:
if n % 2 == 0:
s = s + "c r-----s\n"
s = s + "|-----sw-----|\n"
s = s + "c---sw sw-----s\n"
s = s + " |-----R-----|\n"
else:
s = s + "c-----sw-----r-----s\n"
s = s + "c---sw----R-----sw-----s\n"
else:
s = s + "|-----sw-----|\n"
s = s + " |-----R-----|\n"
i = i + 1
"""
return s

View File

@ -8,13 +8,16 @@ class MpTopo:
clientName = "Client"
serverName = "Server"
routerName = "Router"
cmdLog = "command.log"
"""Simple MpTopo"""
def __init__(self, topoBuilder, topoParam):
self.topoBuilder = topoBuilder
self.topoParam = topoParam
self.logFile = open(MpTopo.cmdLog, 'w')
def commandTo(self, who, cmd):
self.logFile.write(who.__str__() + " : " + cmd + "\n")
self.topoBuilder.commandTo(who, cmd)
def getHost(self, who):
@ -35,5 +38,8 @@ class MpTopo:
def startNetwork(self):
self.topoBuilder.startNetwork()
def closeLogFile(self):
self.logFile.close()
def stopNetwork(self):
self.topoBuilder.stopNetwork()