mpLinkCharacteristics: use class, not qdisc for htb
This commit is contained in:
parent
6336c158df
commit
e2701685b7
@ -4,6 +4,7 @@
|
|||||||
class MpLinkCharacteristics:
|
class MpLinkCharacteristics:
|
||||||
|
|
||||||
tcNetemParent = "5:1"
|
tcNetemParent = "5:1"
|
||||||
|
tcHtbClassid = "10"
|
||||||
tcNetemHandle = "10:"
|
tcNetemHandle = "10:"
|
||||||
|
|
||||||
def __init__(self, id, delay, queueSize, bandwidth, loss, back_up=False):
|
def __init__(self, id, delay, queueSize, bandwidth, loss, back_up=False):
|
||||||
@ -32,12 +33,17 @@ class MpLinkCharacteristics:
|
|||||||
cmd = ""
|
cmd = ""
|
||||||
for n in self.netemAt:
|
for n in self.netemAt:
|
||||||
cmd = cmd + "sleep " + str(n.delta)
|
cmd = cmd + "sleep " + str(n.delta)
|
||||||
cmd = cmd + " && "
|
cmd = cmd + " && (( tc qdisc del dev " + ifname + " root "
|
||||||
cmd = cmd + " tc qdisc change dev " + ifname + " "
|
cmd = cmd + " && tc class add dev " + ifname + " "
|
||||||
cmd = cmd + " parent " + MpLinkCharacteristics.tcNetemParent
|
cmd = cmd + " parent root "
|
||||||
cmd = cmd + " handle " + MpLinkCharacteristics.tcNetemHandle
|
cmd = cmd + " classid " + MpLinkCharacteristics.tcHtbClassid
|
||||||
cmd = cmd + " htb rate " + self.bandwidth + "mbit"
|
cmd = cmd + " htb rate " + self.bandwidth + "mbit"
|
||||||
cmd = cmd + " burst " + str(int(self.queueSize) * 1500) + " && "
|
cmd = cmd + " burst " + str(int(self.queueSize) * 1500) + ") || "
|
||||||
|
cmd = cmd + " tc class change dev " + ifname + " "
|
||||||
|
cmd = cmd + " parent " + MpLinkCharacteristics.tcNetemParent
|
||||||
|
cmd = cmd + " classid " + MpLinkCharacteristics.tcHtbClassid
|
||||||
|
cmd = cmd + " htb rate " + self.bandwidth + "mbit"
|
||||||
|
cmd = cmd + " burst " + str(int(self.queueSize) * 1500) + ") && "
|
||||||
cmd = cmd + " tc qdisc add dev " + ifname + " "
|
cmd = cmd + " tc qdisc add dev " + ifname + " "
|
||||||
cmd = cmd + " parent " + MpLinkCharacteristics.tcNetemHandle
|
cmd = cmd + " parent " + MpLinkCharacteristics.tcNetemHandle
|
||||||
cmd = cmd + " netem " + n.cmd + " delay " + self.delay + "ms && "
|
cmd = cmd + " netem " + n.cmd + " delay " + self.delay + "ms && "
|
||||||
|
Loading…
Reference in New Issue
Block a user