diff options
author | Jonas Bjurel <jonas.bjurel@ericsson.com> | 2015-11-25 11:32:57 +0100 |
---|---|---|
committer | Jonas Bjurel <jonas.bjurel@ericsson.com> | 2015-11-27 10:24:23 +0100 |
commit | 24a95306d2564b272b5320e9149d9aea70b4061c (patch) | |
tree | 8c1a2c9f7acbfed41f8ebc56a8ae1f7d316f7cff /fuel/deploy/cloud/configure_nodes.py | |
parent | 7077376d6e0ff0dec77080fa21b75911b811475d (diff) |
Restructcture of the directory layout
Restructure of the directory layout due to move of Fuel into it's own repo
JIRA: FUEL-85
Change-Id: I3647e1992a508f29dce06a5d6c790725c527f6f5
Signed-off-by: Jonas Bjurel <jonas.bjurel@ericsson.com>
Diffstat (limited to 'fuel/deploy/cloud/configure_nodes.py')
-rw-r--r-- | fuel/deploy/cloud/configure_nodes.py | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/fuel/deploy/cloud/configure_nodes.py b/fuel/deploy/cloud/configure_nodes.py deleted file mode 100644 index a456679ab..000000000 --- a/fuel/deploy/cloud/configure_nodes.py +++ /dev/null @@ -1,109 +0,0 @@ -############################################################################### -# Copyright (c) 2015 Ericsson AB and others. -# szilard.cserey@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################### - - -import yaml -import io -import glob - -from common import ( - exec_cmd, - check_file_exists, - log, - backup, -) - - -class ConfigureNodes(object): - - def __init__(self, yaml_config_dir, env_id, node_id_roles_dict, dea): - self.yaml_config_dir = yaml_config_dir - self.env_id = env_id - self.node_id_roles_dict = node_id_roles_dict - self.dea = dea - - def config_nodes(self): - log('Configure nodes') - for node_id, roles_blade in self.node_id_roles_dict.iteritems(): - exec_cmd('fuel node set --node-id %s --role %s --env %s' - % (node_id, roles_blade[0], self.env_id)) - - self.download_deployment_config() - for node_id, roles_blade in self.node_id_roles_dict.iteritems(): - self.download_interface_config(node_id) - self.modify_node_interface(node_id, roles_blade) - self.modify_node_network_schemes(node_id, roles_blade) - self.upload_interface_config(node_id) - self.upload_deployment_config() - - def modify_node_network_schemes(self, node_id, roles_blade): - log('Modify network transformations for node %s' % node_id) - type = self.dea.get_node_property(roles_blade[1], 'transformations') - transformations = self.dea.get_property(type) - deployment_dir = '%s/deployment_%s' % ( - self.yaml_config_dir, self.env_id) - backup(deployment_dir) - for node_file in glob.glob(deployment_dir + '/*_%s.yaml' % node_id): - with io.open(node_file) as stream: - node = yaml.load(stream) - - node['network_scheme'].update(transformations) - - with io.open(node_file, 'w') as stream: - yaml.dump(node, stream, default_flow_style=False) - - def download_deployment_config(self): - log('Download deployment config for environment %s' % self.env_id) - exec_cmd('fuel deployment --env %s --default --dir %s' - % (self.env_id, self.yaml_config_dir)) - - def upload_deployment_config(self): - log('Upload deployment config for environment %s' % self.env_id) - exec_cmd('fuel deployment --env %s --upload --dir %s' - % (self.env_id, self.yaml_config_dir)) - - def download_interface_config(self, node_id): - log('Download interface config for node %s' % node_id) - exec_cmd('fuel node --env %s --node %s --network --download ' - '--dir %s' % (self.env_id, node_id, self.yaml_config_dir)) - - def upload_interface_config(self, node_id): - log('Upload interface config for node %s' % node_id) - exec_cmd('fuel node --env %s --node %s --network --upload ' - '--dir %s' % (self.env_id, node_id, self.yaml_config_dir)) - - def modify_node_interface(self, node_id, roles_blade): - log('Modify interface config for node %s' % node_id) - interface_yaml = ('%s/node_%s/interfaces.yaml' - % (self.yaml_config_dir, node_id)) - check_file_exists(interface_yaml) - backup('%s/node_%s' % (self.yaml_config_dir, node_id)) - - with io.open(interface_yaml) as stream: - interfaces = yaml.load(stream) - - net_name_id = {} - for interface in interfaces: - for network in interface['assigned_networks']: - net_name_id[network['name']] = network['id'] - - type = self.dea.get_node_property(roles_blade[1], 'interfaces') - interface_config = self.dea.get_property(type) - - for interface in interfaces: - interface['assigned_networks'] = [] - if interface['name'] in interface_config: - for net_name in interface_config[interface['name']]: - net = {} - net['id'] = net_name_id[net_name] - net['name'] = net_name - interface['assigned_networks'].append(net) - - with io.open(interface_yaml, 'w') as stream: - yaml.dump(interfaces, stream, default_flow_style=False) |