aboutsummaryrefslogtreecommitdiff
path: root/rumba/prototypes
diff options
context:
space:
mode:
authorMarco Capitani <m.capitani@nextworks.it>2017-04-14 17:52:56 +0200
committerMarco Capitani <m.capitani@nextworks.it>2017-04-14 17:52:56 +0200
commit6eceae4bf7ee823d6eed276935741b7c107f6105 (patch)
tree27afa85981f5eec4cd12cc05366c5b511ca8e9a6 /rumba/prototypes
parent2f423e0282975b753f6686654f3adc0f535d23d7 (diff)
downloadrumba-6eceae4bf7ee823d6eed276935741b7c107f6105.tar.gz
rumba-6eceae4bf7ee823d6eed276935741b7c107f6105.zip
Implemented several comments on MR 22:
+ Used paramiko for scp (implemented new method in ssh_support + removed (obsoleted) private key for access to vms + used setup_vlans from ssh_support
Diffstat (limited to 'rumba/prototypes')
-rw-r--r--rumba/prototypes/irati.py56
-rw-r--r--rumba/prototypes/irati_rsa27
2 files changed, 26 insertions, 57 deletions
diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py
index edc49c6..89c4fe4 100644
--- a/rumba/prototypes/irati.py
+++ b/rumba/prototypes/irati.py
@@ -31,9 +31,6 @@ import rumba.prototypes.irati_templates as irati_templates
# An experiment over the IRATI implementation
-from rumba import ssh_support
-
-
class Experiment(mod.Experiment):
@staticmethod
@@ -47,6 +44,7 @@ class Experiment(mod.Experiment):
def __init__(self, testbed, nodes=None):
mod.Experiment.__init__(self, testbed, nodes)
self.manager = False
+ self.conf_files = None
if self.testbed.username == 'root':
self.sudo = self.fake_sudo
@@ -94,7 +92,7 @@ class Experiment(mod.Experiment):
print("[IRATI experiment] start")
print("Setting up IRATI on the nodes...")
self.setup()
- self.write_conf()
+ self.conf_files = self.write_conf()
self.bootstrap_network()
self.run_experiment()
print("[IRATI experiment] end")
@@ -107,45 +105,34 @@ class Experiment(mod.Experiment):
:return:
"""
name = node.name
- gen_files_conf = 'shimeth.%(name)s.*.dif da.map %(name)s.ipcm.conf' % {
- 'name': name}
- if any(node in dif.members for dif in self.dif_ordering):
- gen_files_conf = ' '.join(
- [gen_files_conf, 'normal.%(name)s.*.dif' % {'name': name}])
+ gen_files_conf = self.conf_files[node] + ['da.map']
dir_path = os.path.dirname(os.path.abspath(__file__))
gen_files_bin = 'enroll.py'
- gen_files_conf_full = \
- ' '.join([self.conf_dir(x) for x in gen_files_conf.split()])
- gen_files_bin_full = os.path.join(dir_path, 'enroll.py')
+ gen_files_conf_full = [self.conf_dir(x) for x in gen_files_conf]
+ gen_files_bin_full = [os.path.join(dir_path, 'enroll.py')]
ipcm_components = ['scripting', 'console']
if self.manager:
ipcm_components.append('mad')
ipcm_components = ', '.join(ipcm_components)
- gen_files = ' '.join([gen_files_conf_full, gen_files_bin_full])
+ gen_files = gen_files_conf_full + gen_files_bin_full
- sshopts = ('-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
- ' -o IdentityFile=%s'
- % (os.path.join(dir_path, 'irati_rsa',)))
format_args = {'name': name,
'ssh': node.ssh_config.port,
'username': self.testbed.username,
'genfiles': gen_files,
- 'genfilesconf': gen_files_conf,
+ 'genfilesconf': ' '.join(gen_files_conf),
'genfilesbin': gen_files_bin,
- 'sshopts': sshopts,
'installpath': '/usr',
'verb': 'DBG',
'ipcmcomps': ipcm_components}
try:
- print('DEBUG: executing >> '
- 'scp %(sshopts)s -r -P %(ssh)s '
- '%(genfiles)s %(username)s@localhost:'
- % format_args)
- subprocess.check_call(('scp %(sshopts)s -r -P %(ssh)s '
- '%(genfiles)s %(username)s@localhost:'
- % format_args), shell=True)
+ # TODO: watch out for empty path...
+ ssh.copy_paths_to_testbed(self.testbed,
+ node.ssh_config,
+ gen_files,
+ '')
except subprocess.CalledProcessError as e:
raise Exception(str(e))
@@ -154,7 +141,8 @@ class Experiment(mod.Experiment):
cmds = [self.sudo('hostname %(name)s' % format_args),
self.sudo('chmod a+rw /dev/irati'),
self.sudo('mv %(genfilesconf)s /etc' % format_args),
- self.sudo('mv %(genfilesbin)s /usr/bin') % format_args]
+ self.sudo('mv %(genfilesbin)s /usr/bin') % format_args,
+ self.sudo('chmod a+x /usr/bin/enroll.py') % format_args]
# TODO: is the port up on the VM at this point?
@@ -167,7 +155,7 @@ class Experiment(mod.Experiment):
# print('Credentials:')
# print(node.ssh_config.hostname, node.ssh_config.port,
# self.testbed.username, self.testbed.password)
- ssh_support.execute_commands(self.testbed, node.ssh_config, cmds)
+ ssh.execute_commands(self.testbed, node.ssh_config, cmds)
def enroll_nodes(self):
"""Runs the enrollments one by one, respecting dependencies"""
@@ -198,9 +186,9 @@ class Experiment(mod.Experiment):
# print(e['enrollee'].ssh_config.hostname,
# e['enrollee'].ssh_config.port,
# self.testbed.username, self.testbed.password)
- ssh_support.execute_command(self.testbed,
- e['enrollee'].ssh_config,
- cmd)
+ ssh.execute_command(self.testbed,
+ e['enrollee'].ssh_config,
+ cmd)
def write_conf(self):
"""Write the configuration files"""
@@ -210,6 +198,7 @@ class Experiment(mod.Experiment):
ipcp2shim_map = {}
node2id_map = {}
mgmt_dif_name = 'NMS'
+ conf_files = {} # dict of per-nod conf files
# TODO: what format are the mappings registered in? Is this ok?
app_mappings = []
@@ -298,6 +287,8 @@ class Experiment(mod.Experiment):
},
indent=4, sort_keys=True))
fout.close()
+ conf_files.setdefault(node, []).append(
+ 'shimeth.%s.%s.dif' % (node.name, shim.name))
# Run over dif_ordering array, to make sure each IPCM config has
# the correct ordering for the ipcProcessesToCreate list of operations.
@@ -360,6 +351,8 @@ class Experiment(mod.Experiment):
node_file,
indent=4,
sort_keys=True)
+ conf_files.setdefault(node, []).append(
+ '%s.ipcm.conf' % (node.name,))
for dif in self.dif_ordering: # type: mod.DIF
dif_conf = difconfs.get(dif.name, None)
@@ -373,3 +366,6 @@ class Experiment(mod.Experiment):
dif_conf_file,
indent=4,
sort_keys=True)
+ conf_files.setdefault(node, []).append(
+ 'normal.%s.%s.dif' % (node.name, dif.name))
+ return conf_files
diff --git a/rumba/prototypes/irati_rsa b/rumba/prototypes/irati_rsa
deleted file mode 100644
index 8119a76..0000000
--- a/rumba/pr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