diff options
author | Szilard Cserey <szilard.cserey@ericsson.com> | 2015-03-18 15:49:24 +0100 |
---|---|---|
committer | Szilard Cserey <szilard.cserey@ericsson.com> | 2015-04-02 12:15:28 +0200 |
commit | 1e066de62f2b4bcc833ce62a16efdcbf71d3dd9b (patch) | |
tree | fc860e3f5cf9afbcc91ae4589054109a9a8ea26d /fuel/deploy/dea.py | |
parent | 3eed12baa4753bf7f1eadc2b99465af38086f14f (diff) |
Automatic Deployment
- Deployment Hardware Adapter
- Deployment Environment Adapter
- Fuel environment cleanup
- Fuel environment configuration
JIRA: [BGS-2] Create Fuel deployment script
Change-Id: Ie8aa6c0817a73c507cb4345bde1e2c904bb5b105
Signed-off-by: Szilard Cserey <szilard.cserey@ericsson.com>
Diffstat (limited to 'fuel/deploy/dea.py')
-rw-r--r-- | fuel/deploy/dea.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/fuel/deploy/dea.py b/fuel/deploy/dea.py new file mode 100644 index 0000000..0ab215d --- /dev/null +++ b/fuel/deploy/dea.py @@ -0,0 +1,52 @@ +import yaml + +class DeploymentEnvironmentAdapter(object): + def __init__(self): + self.dea_struct = None + self.blade_ids = {} + self.blades = {} + self.shelf_ids = [] + + def parse_yaml(self, yaml_path): + with open(yaml_path) as yaml_file: + self.dea_struct = yaml.load(yaml_file) + self.collect_shelf_and_blade_info() + + def get_no_of_blades(self): + no_of_blades = 0 + for shelf in self.dea_struct['shelf']: + no_of_blades += len(shelf['blade']) + return no_of_blades + + def get_server_type(self): + return self.dea_struct['server_type'] + + def get_environment_name(self): + return self.dea_struct['name'] + + def get_shelf_ids(self): + return self.shelf_ids + + def get_blade_ids(self, shelf_id): + return self.blade_ids[shelf_id] + + def collect_shelf_and_blade_info(self): + self.blade_ids = {} + self.blades = {} + self.shelf_ids = [] + for shelf in self.dea_struct['shelf']: + self.shelf_ids.append(shelf['id']) + blade_ids = self.blade_ids[shelf['id']] = [] + blades = self.blades[shelf['id']] = {} + for blade in shelf['blade']: + blade_ids.append(blade['id']) + blades[blade['id']] = blade + + def is_controller(self, shelf_id, blade_id): + blade = self.blades[shelf_id][blade_id] + return (True if 'role' in blade and blade['role'] == 'controller' + else False) + + def is_compute_host(self, shelf_id, blade_id): + blade = self.blades[shelf_id][blade_id] + return True if 'role' not in blade else False
\ No newline at end of file |