aboutsummaryrefslogtreecommitdiff
path: root/rumba/elements/experimentation.py
diff options
context:
space:
mode:
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):
"""