aboutsummaryrefslogtreecommitdiff
path: root/rumba/elements/experimentation.py
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2021-07-19 21:56:11 +0200
committerDimitri Staessens <dimitri@ouroboros.rocks>2021-07-19 21:56:11 +0200
commit1abd211bb7b58dc258570116af9403ecf0e28da9 (patch)
tree5f3dcd7bfb778e724b141d164f4dda4d33ba5f73 /rumba/elements/experimentation.py
parent97b16ada2b710cfe88c3bc6bf9e0dc42a943fca5 (diff)
downloadrumba-1abd211bb7b58dc258570116af9403ecf0e28da9.tar.gz
rumba-1abd211bb7b58dc258570116af9403ecf0e28da9.zip
experiment: Move link rate setting to prototype
Apparently I didn't test my final change for this feature when I moved it from the storyboard to the experiment. It didn't work, I tried to put it in the testbed class, but that was a mess, so for now it's moved to the prototype.
Diffstat (limited to 'rumba/elements/experimentation.py')
-rw-r--r--rumba/elements/experimentation.py36
1 files changed, 11 insertions, 25 deletions
diff --git a/rumba/elements/experimentation.py b/rumba/elements/experimentation.py
index 03d90bb..efd7a3e 100644
--- a/rumba/elements/experimentation.py
+++ b/rumba/elements/experimentation.py
@@ -540,36 +540,22 @@ class Experiment(object):
def _stop_metrics_exporter(self, nodes):
raise Exception('start_metrics_exporter() method not implemented')
- def set_eth_link_rate_to(self, src, dst, megabit):
+ @abc.abstractmethod
+ def _set_phy_link_rate_to(self, src, dst, megabit):
+ raise Exception('set_phy_k')
+
+ def set_phy_link_rate_to(self, src, dst, megabit):
"""
- Sets the link rate on src NIC towards dst with ethtool
- Fixme: This should be moved to the testbed class
- Fixme: Test if testbed is a physical Linux server
+ Sets the physical link rate in the experiment
"""
+ self._set_phy_link_rate_to(src, dst, megabit)
- if megabit not in [10, 100, 1000]:
- return
-
- self.run_command(src, "route | grep $(ping server -c 1 | head -n1 | cut -f3 -d' ' | head -c -3 | tail -c +2) | "
- "grep -o '[^ ]*$' > iface ".format(dst))
- self.run_command(src, "sudo ethtool -s $(cat iface) speed {} duplex full autoneg off".format(megabit))
- self.run_command(src, "sudo ip link set $(cat iface) down")
- self.run_command(src, "sudo ip link set $(cat iface) up && sleep 10")
- self.run_command(src, "sudo ethtool $(cat iface) | grep '{}Mb/s'".format(megabit))
- self.run_command(src, "rm iface")
- self.run_command(src, "while ! ping -c 1 {}; do sleep 1; done".format(dst))
-
- def set_eth_link_rate_between(self, src, dst, megabit):
+ def set_phy_link_rate_between(self, src, dst, megabit):
"""
- Sets the link rate with ethtool
- Fixme: This should be moved to the testbed class
- Fixme: Test if testbed is a physical Linux server
+ Sets the physical link rate in the experiment
"""
- if megabit not in [10, 100, 1000]:
- return
-
- self.set_eth_link_rate_to(src, dst, megabit)
- self.set_eth_link_rate_to(dst, src, megabit)
+ self._set_phy_link_rate_to(src, dst, megabit)
+ self._set_phy_link_rate_to(dst, src, megabit)
def swap_in(self):
"""