From 1abd211bb7b58dc258570116af9403ecf0e28da9 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Mon, 19 Jul 2021 21:56:11 +0200 Subject: 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. --- rumba/prototypes/ouroboros.py | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'rumba/prototypes/ouroboros.py') diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py index 1558acd..c8d286f 100644 --- a/rumba/prototypes/ouroboros.py +++ b/rumba/prototypes/ouroboros.py @@ -145,8 +145,10 @@ class Experiment(mod.Experiment): @staticmethod def make_executor(node, packages, testbed): def executor(commands): - ssh.aptitude_install(testbed, node, packages) - node.execute_commands(commands, time_out=None, use_proxy=True) + if packages and len(packages) > 0: + ssh.aptitude_install(testbed, node, packages) + if commands and len(commands) > 0: + node.execute_commands(commands, time_out=None, use_proxy=True) return executor def prototype_name(self): @@ -184,14 +186,20 @@ class Experiment(mod.Experiment): executors = [] args = [] + if nodes and isinstance(nodes, str): + nodes = [nodes] + if nodes is None: - nodes = self.nodes + _nodes = self.nodes + else: + _nodes = [node for node in self.nodes if node.name in nodes] - for node in nodes: + for node in _nodes: executor = self.make_executor(node, packages, self.testbed) names.append(node.name) executors.append(executor) args.append(cmds) + m_processing.call_in_parallel(names, args, executors) def install_ouroboros(self): @@ -293,6 +301,19 @@ class Experiment(mod.Experiment): self._install_packages_and_execute_cmds([], cmds, nodes) + def _set_phy_link_rate_to(self, src, dst, megabit): + + commands = ["route | grep $(ping server -c 1 | head -n1 | cut -f3 -d' ' | head -c -3 | tail -c +2) | " + "grep -o '[^ ]*$' > iface ".format(dst), + "sudo ethtool -s $(cat iface) speed {} duplex full autoneg off".format(megabit), + "sudo ip link set $(cat iface) down", + "sudo ip link set $(cat iface) up && sleep 10", + "sudo ethtool $(cat iface) | grep '{}Mb/s'".format(megabit), + "rm iface", + "while ! ping -c 1 {}; do sleep 1; done".format(dst)] + + self._install_packages_and_execute_cmds([], commands, [src]) + def create_ipcps(self): for node in self.nodes: cmds = list() -- cgit v1.2.3