This commit is contained in:
Quentin De Coninck 2019-11-27 13:50:51 +01:00
parent 1d2580eb53
commit e7a32f471e

View File

@ -53,12 +53,11 @@ class MpLinkCharacteristics:
for n in self.netemAt: for n in self.netemAt:
cmd = cmd + "sleep " + str(n.delta) cmd = cmd + "sleep " + str(n.delta)
cmd = cmd + " && tc qdisc del dev " + ifname + " root " cmd = cmd + " && tc qdisc del dev " + ifname + " root "
cmd = cmd + " && tc qdisc add dev {} root handle 5:0 htb default 1".format(ifname) cmd = cmd + " && tc qdisc add dev {} root handle 5:0 tbf rate {}mbit burst {} latency {}ms".format(ifname, self.bandwidth, 1500 * int(self.queueSize), self.queuingDelay)
cmd = cmd + " && tc class add dev {} parent 5:0 class 5:1 htb rate {}Mbit burst {}".format(ifname, self.bandwidth, int(self.queueSize) * 1500)
cmd = cmd + " && tc qdisc add dev {} handle ffff: ingress".format(ifname) cmd = cmd + " && tc qdisc add dev {} handle ffff: ingress".format(ifname)
cmd = cmd + " && tc filter add dev {} parent ffff: u32 match u32 0 0 police rate {}mbit burst {} drop".format(ifname, self.bandwidth, int(self.queueSize) * 1500) cmd = cmd + " && tc filter add dev {} parent ffff: u32 match u32 0 0 police rate {}mbit burst {} drop".format(ifname, self.bandwidth, int(self.queueSize) * 1500)
cmd = cmd + " && tc qdisc add dev {} parent 5:1 handle 10: netem {} delay {}ms limit 1000000 &&".format(ifname, n.cmd, self.delay) cmd = cmd + " && tc qdisc add dev {} parent 5:0 handle 10: netem {} delay {}ms limit 1000000 &&".format(ifname, n.cmd, self.delay)
cmd = cmd + " true &" cmd = cmd + " true &"
return cmd return cmd