update changing commands

This commit is contained in:
Quentin De Coninck 2020-07-03 16:45:18 +02:00
parent f62ca96ab4
commit 8f1739920f

View File

@ -89,7 +89,7 @@ class LinkCharacteristics(object):
"change" if change else "add", ifname, self.bandwidth, self.buffer_size()) "change" if change else "add", ifname, self.bandwidth, self.buffer_size())
def build_changing_bandwidth_cmd(self, ifname): def build_changing_bandwidth_cmd(self, ifname):
return "&&".join( return "&& ".join(
["sleep {} && {} ".format( ["sleep {} && {} ".format(
n.delta, self.build_bandwidth_cmd(ifname, change=True)) for n in self.netem_at] n.delta, self.build_bandwidth_cmd(ifname, change=True)) for n in self.netem_at]
+ ["true &"] + ["true &"]
@ -100,7 +100,7 @@ class LinkCharacteristics(object):
"change" if change else "add", ifname, cmd, "delay {}ms limit 50000".format(self.delay) if not change else "") "change" if change else "add", ifname, cmd, "delay {}ms limit 50000".format(self.delay) if not change else "")
def build_changing_netem_cmd(self, ifname): def build_changing_netem_cmd(self, ifname):
return "&&".join( return "&& ".join(
["sleep {} && {} ".format( ["sleep {} && {} ".format(
n.delta, self.build_netem_cmd(ifname, n.cmd, change=True)) for n in self.netem_at] n.delta, self.build_netem_cmd(ifname, n.cmd, change=True)) for n in self.netem_at]
+ ["true &"] + ["true &"]
@ -113,7 +113,7 @@ class LinkCharacteristics(object):
self.bandwidth, int(self.buffer_size()) * 1.2) self.bandwidth, int(self.buffer_size()) * 1.2)
def build_changing_policing_cmd(self, ifname): def build_changing_policing_cmd(self, ifname):
return "&&".join( return "&& ".join(
["sleep {} && {} ".format( ["sleep {} && {} ".format(
n.delta, self.build_policing_cmd(ifname, change=True)) for n in self.netem_at] n.delta, self.build_policing_cmd(ifname, change=True)) for n in self.netem_at]
+ ["true &"] + ["true &"]