aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rumba/model.py2
-rw-r--r--rumba/ssh_support.py13
-rw-r--r--rumba/testbeds/emulab.py4
3 files changed, 13 insertions, 6 deletions
diff --git a/rumba/model.py b/rumba/model.py
index 6f031ac..8e63822 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -122,7 +122,7 @@ class NormalDIF(DIF):
def del_policy(self, comp):
del self.policies[comp]
- def __repr__(self):
+ def show(self):
s = DIF.__repr__(self)
for comp, pol in self.policies.items():
s += "\n Component %s has policy %s" % (comp, pol)
diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py
index c9ae687..30ada62 100644
--- a/rumba/ssh_support.py
+++ b/rumba/ssh_support.py
@@ -33,6 +33,7 @@ def _print_stream(stream):
o_array = o.split('\\n')
for oi in o_array:
print(oi)
+ return o
def execute_commands(testbed, ssh_config, commands, time_out=3):
'''
@@ -52,15 +53,19 @@ def execute_commands(testbed, ssh_config, commands, time_out=3):
ssh_client.connect(ssh_config.hostname, ssh_config.port,
testbed.username, testbed.password,
look_for_keys=True, timeout=time_out)
+ o = ""
for command in commands:
print("%s@%s:%s >> %s" % (testbed.username,
- ssh_config.hostname, ssh_config.port, command))
+ ssh_config.hostname,
+ ssh_config.port,
+ command))
envars = '. /etc/profile;'
command = envars + ' ' + command
stdin, stdout, stderr = ssh_client.exec_command(command)
- _print_stream(stdout)
+ o = _print_stream(stdout)
_print_stream(stderr)
ssh_client.close()
+ return o
except Exception as e:
print(str(e))
@@ -80,7 +85,9 @@ def execute_command(testbed, ssh_config, command, time_out=3):
@return: stdout resulting from the command
'''
- return execute_commands(testbed, ssh_config, [command], time_out)
+ o = execute_commands(testbed, ssh_config, [command], time_out)
+ if o != None:
+ return o
def copy_file_to_testbed(testbed, ssh_config, text, file_name):
'''
diff --git a/rumba/testbeds/emulab.py b/rumba/testbeds/emulab.py
index aee438e..c031327 100644
--- a/rumba/testbeds/emulab.py
+++ b/rumba/testbeds/emulab.py
@@ -125,7 +125,7 @@ class Testbed(mod.Testbed):
ns = self.generate_ns_script(experiment)
dest_file_name = '/users/'+ self.username + \
'/temp_ns_file.%s.ns' % os.getpid()
- ssh.copy_file_to_testbed(self, self.ops_server(), ns, dest_file_name)
+ ssh.copy_file_to_testbed(self, self.ops_ssh_config, ns, dest_file_name)
cmd = '/usr/testbed/bin/sslxmlrpc_client.py startexp ' + \
'batch=false wait=true proj="' + proj_name + \
@@ -203,7 +203,7 @@ class Testbed(mod.Testbed):
'''
for node in experiment.nodes:
- node.ssh_config.hostname = self.full_name(experiment.nodes[0].name)
+ node.ssh_config.hostname = self.full_name(node.name)
cmd = 'cat /var/emulab/boot/topomap'
topomap = ssh.execute_command(self, experiment.nodes[0].ssh_config, cmd)