diff --git a/src/mpECMPSingleInterfaceTopo.py b/src/mpECMPSingleInterfaceTopo.py index 105f7e6..9acb60d 100644 --- a/src/mpECMPSingleInterfaceTopo.py +++ b/src/mpECMPSingleInterfaceTopo.py @@ -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 diff --git a/src/mpTopo.py b/src/mpTopo.py index f7d5b83..4b65081 100644 --- a/src/mpTopo.py +++ b/src/mpTopo.py @@ -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): @@ -34,6 +37,9 @@ class MpTopo: def startNetwork(self): self.topoBuilder.startNetwork() + + def closeLogFile(self): + self.logFile.close() def stopNetwork(self): self.topoBuilder.stopNetwork()