diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2018-06-12 16:40:11 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2018-06-12 16:40:11 +0200 |
commit | cd34f0b66e7981490bd50752abe68ea11481963c (patch) | |
tree | d65a196c996dd8ec207789601f8ce8e3c9b5fa5f /rumba/prototypes/ouroboros.py | |
parent | b1354ee6dfc5d77b631348356fb823d1c1a85e02 (diff) | |
download | rumba-cd34f0b66e7981490bd50752abe68ea11481963c.tar.gz rumba-cd34f0b66e7981490bd50752abe68ea11481963c.zip |
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.
Diffstat (limited to 'rumba/prototypes/ouroboros.py')
-rw-r--r-- | rumba/prototypes/ouroboros.py | 30 |
1 files changed, 23 insertions, 7 deletions
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: |