aboutsummaryrefslogtreecommitdiff
path: root/rumba/testbeds
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-09-18 12:57:57 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2017-09-18 13:05:44 +0200
commita47f94f48fa4e6856ac1ac63e871aa8363035dc7 (patch)
tree894a1992d3aa7cbc0aa5e56e29ffe2ad03ac0ddd /rumba/testbeds
parent2f160576cf94a5aaadf87c84d5e4153549acffaa (diff)
downloadrumba-a47f94f48fa4e6856ac1ac63e871aa8363035dc7.tar.gz
rumba-a47f94f48fa4e6856ac1ac63e871aa8363035dc7.zip
testbeds: emulab: Continue if experiment is swapped in
This will let rumba continue if the experiment is already swapped in in emulab, since it is not an error. It also adds the posibility to swap the experiment out from Rumba.
Diffstat (limited to 'rumba/testbeds')
-rw-r--r--rumba/testbeds/emulab.py45
1 files changed, 38 insertions, 7 deletions
diff --git a/rumba/testbeds/emulab.py b/rumba/testbeds/emulab.py
index 66c5b7f..7568815 100644
--- a/rumba/testbeds/emulab.py
+++ b/rumba/testbeds/emulab.py
@@ -102,6 +102,8 @@ class Testbed(mod.Testbed):
Swaps experiment in
@param self: testbed info
+
+ @return: Is the experiment newly swapped in
"""
cmd = '/usr/testbed/bin/sslxmlrpc_client.py swapexp proj=' + \
self.proj_name + \
@@ -109,9 +111,17 @@ class Testbed(mod.Testbed):
self.exp_name + \
' direction=in'
- output = ssh.execute_command(self, self.ops_ssh_config, cmd)
+ try:
+ ssh.execute_command(self, self.ops_ssh_config, cmd)
+ except ssh.SSHException as e:
+ line = re.findall(r'not swapped out', str(e))
+ if line:
+ logger.info("Experiment is already swapped in.")
+ return False
+ else:
+ raise e
- return output
+ return True
def _create_experiment(self, experiment):
"""
@@ -142,9 +152,14 @@ class Testbed(mod.Testbed):
'" exp="' + exp_name + '" noswapin=true ' + \
'nsfilepath="' + dest_file_name + '"'
- ssh.execute_command(self, self.ops_ssh_config, cmd, time_out=None)
- ssh.execute_command(self, self.ops_ssh_config, 'rm ' + dest_file_name)
- logger.info("New experiment succesfully created.")
+ try:
+ ssh.execute_command(self, self.ops_ssh_config, cmd, time_out=None)
+ logger.info("New experiment succesfully created.")
+ except:
+ logger.info("Experiment already exists.")
+ finally:
+ ssh.execute_command(self, self.ops_ssh_config,
+ 'rm ' + dest_file_name)
def generate_ns_script(self, experiment):
"""
@@ -250,6 +265,22 @@ class Testbed(mod.Testbed):
def swap_in(self, experiment):
self._create_experiment(experiment)
- self.swap_exp_in()
- self.wait_until_nodes_up()
+ wait = self.swap_exp_in()
+ if wait:
+ self.wait_until_nodes_up()
self.complete_experiment_graph(experiment)
+
+
+ def swap_out(self, experiment):
+ """
+ Swaps experiment out
+
+ @param self: testbed info
+ """
+ cmd = '/usr/testbed/bin/sslxmlrpc_client.py swapexp proj=' + \
+ self.proj_name + \
+ ' exp=' + \
+ self.exp_name + \
+ ' direction=out'
+
+ ssh.execute_command(self, self.ops_ssh_config, cmd)