first implem of netem change,
only implemented for para topo, for now. example: sudo ./mpPerf.py -t conf/topo/0_para_2 -x conf/xp/3_ncpv after two seconds, delay goes to 100ms after five seconds, delay goes to 2ms but loss rate goes to 10% Signed-off-by: Benjamin Hesmans <benjamin.hesmans@uclouvain.be>
This commit is contained in:
parent
56c7196245
commit
ca49762bd4
@ -7,3 +7,7 @@ error
|
||||
path_0:10,15,5
|
||||
path_1:40,10,5
|
||||
topoType:MultiIf
|
||||
changeNetem:yes
|
||||
#netem_{path_id}:at,cmd
|
||||
netemAt_0:2,delay 100ms limit 15
|
||||
netemAt_0:5,delay 2ms limit 15 loss 10%
|
||||
|
@ -1,4 +1,3 @@
|
||||
xpType:ncpv
|
||||
ncClientPort_0:33400
|
||||
ncClientPort_1:33401
|
||||
clientPcap:yes
|
||||
|
@ -26,9 +26,24 @@ class MpExperience:
|
||||
return
|
||||
print("Will change netem config on the fly")
|
||||
links = self.mpTopo.getLinkCharacteristics()
|
||||
i = 0
|
||||
for l in links:
|
||||
cmd = l.buildNetemCmd()
|
||||
lname = self.mpConfig.getMidLeftName(i)
|
||||
rname = self.mpConfig.getMidRightName(i)
|
||||
lbox = self.mpTopo.getHost(lname)
|
||||
lif = self.mpConfig.getMidL2RInterface(i)
|
||||
rif = self.mpConfig.getMidR2LInterface(i)
|
||||
rbox = self.mpTopo.getHost(rname)
|
||||
print(str(lname) + " " + str(lif))
|
||||
print(str(rname) + " " + str(rif))
|
||||
print("boxes " + str(lbox) + " " + str(rbox))
|
||||
cmd = l.buildNetemCmd(lif)
|
||||
print(cmd)
|
||||
self.mpTopo.commandTo(lbox, cmd)
|
||||
cmd = l.buildNetemCmd(rif)
|
||||
print(cmd)
|
||||
self.mpTopo.commandTo(rbox, cmd)
|
||||
i = i + 1
|
||||
|
||||
def run(self):
|
||||
pass
|
||||
|
@ -2,6 +2,10 @@
|
||||
|
||||
|
||||
class MpLinkCharacteristics:
|
||||
|
||||
tcNetemParent = "5:1"
|
||||
tcNetemHandle = "10:"
|
||||
|
||||
def __init__(self, id, delay, queueSize, bandwidth):
|
||||
self.id = id
|
||||
self.delay = delay
|
||||
@ -11,7 +15,7 @@ class MpLinkCharacteristics:
|
||||
|
||||
def addNetemAt(self, n):
|
||||
if len(self.netemAt) == 0:
|
||||
n.delay = n.at
|
||||
n.delta = n.at
|
||||
self.netemAt.append(n)
|
||||
else:
|
||||
if n.at > self.netemAt[-1].at:
|
||||
@ -22,12 +26,15 @@ class MpLinkCharacteristics:
|
||||
"because ooo !")
|
||||
pass
|
||||
|
||||
def buildNetemCmd(self):
|
||||
def buildNetemCmd(self, ifname):
|
||||
cmd = ""
|
||||
for n in self.netemAt:
|
||||
cmd = cmd + "sleep " + str(n.delta)
|
||||
cmd = cmd + " && "
|
||||
cmd = cmd + " echo " + n.cmd + " && "
|
||||
cmd = cmd + " tc qdisc change dev " + ifname + " "
|
||||
cmd = cmd + " parent " + MpLinkCharacteristics.tcNetemParent
|
||||
cmd = cmd + " handle " + MpLinkCharacteristics.tcNetemHandle
|
||||
cmd = cmd + " netem " + n.cmd + " && "
|
||||
cmd = cmd + " true &"
|
||||
return cmd
|
||||
|
||||
|
@ -105,7 +105,7 @@ class MpMultiInterfaceConfig(MpConfig):
|
||||
return MpTopo.routerName
|
||||
|
||||
def getMidL2RInterface(self, id):
|
||||
return self.getMidLeftName(id) + "-eth1"
|
||||
return self.getMidLeftName(id) + "-eth2"
|
||||
|
||||
def getMidR2LInterface(self, id):
|
||||
return self.getMidRightName(id) + "-eth" + str(id)
|
||||
|
Loading…
Reference in New Issue
Block a user