diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2017-04-11 19:12:53 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-04-11 19:12:53 +0200 |
commit | f5f9fba3d6b657fd5daa31e4981c055a05c596e8 (patch) | |
tree | def87ce8de8656f07cf9f79b209d794f5414b0c1 /rumba/testbeds/emulab.py | |
parent | 662c33bf7ce9ddf3bcc77f7d5f51c958d2b837ad (diff) | |
download | rumba-f5f9fba3d6b657fd5daa31e4981c055a05c596e8.tar.gz rumba-f5f9fba3d6b657fd5daa31e4981c055a05c596e8.zip |
ssh_support: Pass SSHConfig instead of only hostname
Only the hostname was passed to the ssh_support component. This passes
an object that can also hold the port number. It can be extended to
take other things as well, such as a proxy.
Diffstat (limited to 'rumba/testbeds/emulab.py')
-rw-r--r-- | rumba/testbeds/emulab.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/rumba/testbeds/emulab.py b/rumba/testbeds/emulab.py index c4dbe36..aee438e 100644 --- a/rumba/testbeds/emulab.py +++ b/rumba/testbeds/emulab.py @@ -43,6 +43,7 @@ class Testbed(mod.Testbed): self.url = url self.image = image self.ip = dict() + self.ops_ssh_config = mod.SSHConfig(self.ops_server()) def ops_server(self): ''' @@ -76,7 +77,7 @@ class Testbed(mod.Testbed): @return: list of created experiments (strings) ''' cmd = '/usr/testbed/bin/sslxmlrpc_client.py -m experiment getlist' - out = ssh.execute_command(self, self.ops_server(), cmd) + out = ssh.execute_command(self, self.ops_ssh_config, cmd) try: if project_name != None: @@ -98,7 +99,7 @@ class Testbed(mod.Testbed): self.exp_name + \ ' direction=in' - output = ssh.execute_command(self, self.ops_server(), cmd) + output = ssh.execute_command(self, self.ops_ssh_config, cmd) return output @@ -131,8 +132,8 @@ class Testbed(mod.Testbed): '" exp="' + exp_name + '" noswapin=true ' + \ 'nsfilepath="' + dest_file_name + '"' - ssh.execute_command(self, self.ops_server(), cmd, time_out=None) - ssh.execute_command(self, self.ops_server(), 'rm ' + 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) print("New experiment succesfully created.") def generate_ns_script(self, experiment): @@ -182,12 +183,12 @@ class Testbed(mod.Testbed): self.exp_name + \ ' -a | grep State | cut -f2,2 -d " "' - res = ssh.execute_command(self, self.ops_server(), cmd) + res = ssh.execute_command(self, self.ops_ssh_config, cmd) active = False if res == "active": active = True while active != True: - res = ssh.execute_command(self, self.ops_server(), cmd) + res = ssh.execute_command(self, self.ops_ssh_config, cmd) if res == "active": active = True print("Still waiting") @@ -201,9 +202,11 @@ class Testbed(mod.Testbed): @param experiment: the experiment ''' - node_full_name = self.full_name(experiment.nodes[0].name) + for node in experiment.nodes: + node.ssh_config.hostname = self.full_name(experiment.nodes[0].name) + cmd = 'cat /var/emulab/boot/topomap' - topomap = ssh.execute_command(self, node_full_name, cmd) + topomap = ssh.execute_command(self, experiment.nodes[0].ssh_config, cmd) # Almost as ugly as yo momma index = topomap.rfind("# lans") topo_array = topomap[:index].split('\\n')[1:-1] @@ -224,8 +227,7 @@ class Testbed(mod.Testbed): for node in experiment.nodes: cmd = 'cat /var/emulab/boot/ifmap' - node_full_name = self.full_name(node.name) - output = ssh.execute_command(self, node_full_name, cmd) + output = ssh.execute_command(self, node.ssh_config, cmd) output = re.split('\\\\n', output) for item in output: item = item.split() @@ -233,7 +235,6 @@ class Testbed(mod.Testbed): if isinstance(ipcp, mod.ShimEthIPCP): if self.ip[ipcp] == item[1]: ipcp.ifname = item[0] - node.full_name = self.full_name(node.name) def swap_in(self, experiment): self._create_experiment(experiment) |