add back up Signed-off-by: Benjamin Hesmans <benjamin.hesmans@uclouvain.be>
This commit is contained in:
parent
e698e34d45
commit
a45ee9806c
@ -31,6 +31,11 @@ class MpConfig:
|
|||||||
def getClientInterfaceCount(self):
|
def getClientInterfaceCount(self):
|
||||||
raise Exception("To be implemented")
|
raise Exception("To be implemented")
|
||||||
|
|
||||||
|
def interfaceBUPCommand(self, interfaceName):
|
||||||
|
s = "/home/mininet/git/iproute-mptcp/ip/ip link set dev " + interfaceName + " multipath backup "
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
def interfaceUpCommand(self, interfaceName, ip, subnet):
|
def interfaceUpCommand(self, interfaceName, ip, subnet):
|
||||||
s = "ifconfig " + interfaceName + " " + ip + " netmask " + \
|
s = "ifconfig " + interfaceName + " " + ip + " netmask " + \
|
||||||
subnet
|
subnet
|
||||||
|
@ -6,12 +6,13 @@ class MpLinkCharacteristics:
|
|||||||
tcNetemParent = "5:1"
|
tcNetemParent = "5:1"
|
||||||
tcNetemHandle = "10:"
|
tcNetemHandle = "10:"
|
||||||
|
|
||||||
def __init__(self, id, delay, queueSize, bandwidth):
|
def __init__(self, id, delay, queueSize, bandwidth, back_up=False):
|
||||||
self.id = id
|
self.id = id
|
||||||
self.delay = delay
|
self.delay = delay
|
||||||
self.queueSize = queueSize
|
self.queueSize = queueSize
|
||||||
self.bandwidth = bandwidth
|
self.bandwidth = bandwidth
|
||||||
self.netemAt = []
|
self.netemAt = []
|
||||||
|
self.back_up = back_up
|
||||||
|
|
||||||
def addNetemAt(self, n):
|
def addNetemAt(self, n):
|
||||||
if len(self.netemAt) == 0:
|
if len(self.netemAt) == 0:
|
||||||
@ -50,6 +51,7 @@ class MpLinkCharacteristics:
|
|||||||
s = s + "\tDelay : " + str(self.delay) + "\n"
|
s = s + "\tDelay : " + str(self.delay) + "\n"
|
||||||
s = s + "\tQueue Size : " + str(self.queueSize) + "\n"
|
s = s + "\tQueue Size : " + str(self.queueSize) + "\n"
|
||||||
s = s + "\tBandwidth : " + str(self.bandwidth) + "\n"
|
s = s + "\tBandwidth : " + str(self.bandwidth) + "\n"
|
||||||
|
s = s + "\tBack up : " + str(self.back_up) + "\n"
|
||||||
for l in self.netemAt:
|
for l in self.netemAt:
|
||||||
s = s + "\t" + l.__str__() + "\n"
|
s = s + "\t" + l.__str__() + "\n"
|
||||||
return s
|
return s
|
||||||
|
@ -38,16 +38,23 @@ class MpMultiInterfaceConfig(MpConfig):
|
|||||||
self.router = self.topo.getHost(MpTopo.routerName)
|
self.router = self.topo.getHost(MpTopo.routerName)
|
||||||
i = 0
|
i = 0
|
||||||
netmask = "255.255.255.0"
|
netmask = "255.255.255.0"
|
||||||
|
links = self.topo.getLinkCharacteristics()
|
||||||
for l in self.topo.switch:
|
for l in self.topo.switch:
|
||||||
cmd = self.interfaceUpCommand(
|
cmd = self.interfaceUpCommand(
|
||||||
self.getClientInterface(i),
|
self.getClientInterface(i),
|
||||||
self.getClientIP(i), netmask)
|
self.getClientIP(i), netmask)
|
||||||
self.topo.commandTo(self.client, cmd)
|
self.topo.commandTo(self.client, cmd)
|
||||||
|
|
||||||
|
if(links[i].back_up):
|
||||||
|
cmd = self.interfaceBUPCommand(
|
||||||
|
self.getClientInterface(i))
|
||||||
|
self.topo.commandTo(self.client, cmd)
|
||||||
|
|
||||||
cmd = self.interfaceUpCommand(
|
cmd = self.interfaceUpCommand(
|
||||||
self.getRouterInterfaceSwitch(i),
|
self.getRouterInterfaceSwitch(i),
|
||||||
self.getRouterIPSwitch(i), netmask)
|
self.getRouterIPSwitch(i), netmask)
|
||||||
self.topo.commandTo(self.router, cmd)
|
self.topo.commandTo(self.router, cmd)
|
||||||
|
print(str(links[i]))
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(),
|
cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(),
|
||||||
|
@ -50,9 +50,12 @@ class MpParamTopo(MpParam):
|
|||||||
for k in sorted(self.paramDic):
|
for k in sorted(self.paramDic):
|
||||||
if k.startswith("path"):
|
if k.startswith("path"):
|
||||||
tab = self.paramDic[k].split(",")
|
tab = self.paramDic[k].split(",")
|
||||||
if len(tab) == 3:
|
bup = False
|
||||||
|
if len(tab) == 4:
|
||||||
|
bup = tab[3] == 'True'
|
||||||
|
if len(tab) == 3 or len(tab) == 4:
|
||||||
path = MpLinkCharacteristics(i,tab[0],
|
path = MpLinkCharacteristics(i,tab[0],
|
||||||
tab[1], tab[2])
|
tab[1], tab[2], bup)
|
||||||
self.linkCharacteristics.append(path)
|
self.linkCharacteristics.append(path)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user