From cd34f0b66e7981490bd50752abe68ea11481963c Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Tue, 12 Jun 2018 16:40:11 +0200 Subject: elements: Add terminate prototype and reboot nodes This adds functions to terminate the prototype gracefully or forcefully, and to reboot all nodes in the experiment. This is useful when running the experiment interactively, so swapping out and back in is not always required. --- rumba/prototypes/ouroboros.py | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'rumba/prototypes/ouroboros.py') diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py index 643754f..1ca5e6d 100644 --- a/rumba/prototypes/ouroboros.py +++ b/rumba/prototypes/ouroboros.py @@ -169,9 +169,7 @@ class Experiment(mod.Experiment): "git clone -b " + self.git_branch + " " + self.git_repo + \ " " + fs_loc, "cd " + fs_loc + " && mkdir build && cd build && " + - "cmake -DCMAKE_BUILD_TYPE=Debug -DIPCP_FLOW_STATS=True " + - "-DCONNECT_TIMEOUT=60000 -DIPCP_CONN_WAIT_DIR=True " + - "-DREG_TIMEOUT=60000 -DQUERY_TIMEOUT=4000 .. && " + + "cmake .. && " + "sudo make install -j$(nproc)"] names = [] @@ -199,7 +197,7 @@ class Experiment(mod.Experiment): if isinstance(self.testbed, local.Testbed): cmd += " type local layer " + ipcp.dif.name else: - cmd += " type eth-llc dev " + ipcp.ifname + cmd += " type eth-dix dev " + ipcp.ifname cmd += " layer " + ipcp.dif.name elif isinstance(ipcp.dif, mod.NormalDIF): cmd += " type normal" @@ -299,10 +297,28 @@ class Experiment(mod.Experiment): logger.info("All done, have fun!") - def _terminate_prototype(self): + def _terminate_prototype(self, force=False): + cmds = list() + + if force: + kill = 'killall -9 ' + cmds.append(kill + 'irmd') + cmds.append(kill + 'ipcpd-normal') + cmds.append(kill + 'ipcpd-shim-eth-llc') + cmds.append(kill + 'ipcpd-local') + cmds.append('kill -9 $(ps axjf | grep \'sudo irmd\' ' + '| grep -v grep | cut -f4 -d " "') + else: + cmds.append('killall -15 irmd') + + logger.info("Killing Ouroboros...") if isinstance(self.testbed, local.Testbed): - logger.info("Killing IRMd...") - subprocess.check_call('sudo killall -15 irmd'.split()) + cmds = list(map(lambda c: "sudo %s" % (c,), cmds)) + for cmd in cmds: + subprocess.check_call(cmd.split()) + else: + for node in self.nodes: + node.execute_commands(cmds, time_out=None, as_root=True) def destroy_dif(self, dif): for ipcp in dif.ipcps: -- cgit v1.2.3