wip
Signed-off-by: Benjamin Hesmans <benjamin.hesmans@uclouvain.be>
This commit is contained in:
parent
b3c3cbf522
commit
88e92a76d6
@ -26,22 +26,19 @@ class MpECMPSingleInterfaceTopo(MpTopo):
|
|||||||
str(link.id))
|
str(link.id))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
s = "Single if ECMP like env"
|
s = "Single if ECMP like env\n"
|
||||||
"""
|
|
||||||
i = 0
|
i = 0
|
||||||
n = len(self.topoParam.linkCharacteristics)
|
n = len(self.topoParam.linkCharacteristics)
|
||||||
for p in self.topoParam.linkCharacteristics:
|
for p in self.topoParam.linkCharacteristics:
|
||||||
if i == n // 2:
|
if i == n // 2:
|
||||||
if n % 2 == 0:
|
if n % 2 == 0:
|
||||||
s = s + "c r-----s\n"
|
s = s + "c---sw sw-----s\n"
|
||||||
s = s + "|-----sw-----|\n"
|
s = s + " |-----R-----|\n"
|
||||||
else:
|
else:
|
||||||
s = s + "c-----sw-----r-----s\n"
|
s = s + "c---sw----R-----sw-----s\n"
|
||||||
else:
|
else:
|
||||||
s = s + "|-----sw-----|\n"
|
s = s + " |-----R-----|\n"
|
||||||
|
|
||||||
i = i + 1
|
i = i + 1
|
||||||
"""
|
|
||||||
|
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
@ -8,13 +8,16 @@ class MpTopo:
|
|||||||
clientName = "Client"
|
clientName = "Client"
|
||||||
serverName = "Server"
|
serverName = "Server"
|
||||||
routerName = "Router"
|
routerName = "Router"
|
||||||
|
cmdLog = "command.log"
|
||||||
|
|
||||||
"""Simple MpTopo"""
|
"""Simple MpTopo"""
|
||||||
def __init__(self, topoBuilder, topoParam):
|
def __init__(self, topoBuilder, topoParam):
|
||||||
self.topoBuilder = topoBuilder
|
self.topoBuilder = topoBuilder
|
||||||
self.topoParam = topoParam
|
self.topoParam = topoParam
|
||||||
|
self.logFile = open(MpTopo.cmdLog, 'w')
|
||||||
|
|
||||||
def commandTo(self, who, cmd):
|
def commandTo(self, who, cmd):
|
||||||
|
self.logFile.write(who.__str__() + " : " + cmd + "\n")
|
||||||
self.topoBuilder.commandTo(who, cmd)
|
self.topoBuilder.commandTo(who, cmd)
|
||||||
|
|
||||||
def getHost(self, who):
|
def getHost(self, who):
|
||||||
@ -35,5 +38,8 @@ class MpTopo:
|
|||||||
def startNetwork(self):
|
def startNetwork(self):
|
||||||
self.topoBuilder.startNetwork()
|
self.topoBuilder.startNetwork()
|
||||||
|
|
||||||
|
def closeLogFile(self):
|
||||||
|
self.logFile.close()
|
||||||
|
|
||||||
def stopNetwork(self):
|
def stopNetwork(self):
|
||||||
self.topoBuilder.stopNetwork()
|
self.topoBuilder.stopNetwork()
|
||||||
|
Loading…
Reference in New Issue
Block a user