4 ## Copyright (c) 2010-2020 Intel Corporation
6 ## Licensed under the Apache License, Version 2.0 (the "License");
7 ## you may not use this file except in compliance with the License.
8 ## You may obtain a copy of the License at
10 ## http://www.apache.org/licenses/LICENSE-2.0
12 ## Unless required by applicable law or agreed to in writing, software
13 ## distributed under the License is distributed on an "AS IS" BASIS,
14 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ## See the License for the specific language governing permissions and
16 ## limitations under the License.
18 from rapid_log import RapidLog
19 from stackdeployment import StackDeployment
24 import ConfigParser as configparser
26 class RapidStackManager(object):
28 def parse_config(rapid_stack_params):
29 config = configparser.RawConfigParser()
30 config.read('config_file')
32 options = config.options(section)
33 for option in options:
34 rapid_stack_params[option] = config.get(section, option)
35 if 'dataplane_subnet_mask' not in rapid_stack_params.keys():
36 rapid_stack_params['dataplane_subnet_mask'] = 24
37 return (rapid_stack_params)
40 def deploy_stack(rapid_stack_params):
41 cloud_name = rapid_stack_params['cloud_name']
42 stack_name = rapid_stack_params['stack_name']
43 heat_template = rapid_stack_params['heat_template']
44 heat_param = rapid_stack_params['heat_param']
45 user = rapid_stack_params['user']
46 dataplane_subnet_mask = rapid_stack_params['dataplane_subnet_mask']
47 deployment = StackDeployment(cloud_name)
48 deployment.deploy(stack_name, heat_template, heat_param)
49 deployment.generate_env_file(user, dataplane_subnet_mask)
52 rapid_stack_params = {}
53 RapidStackManager.parse_config(rapid_stack_params)
54 log_file = 'CREATE{}.log'.format(rapid_stack_params['stack_name'])
55 RapidLog.log_init(log_file, 'DEBUG', 'INFO', '2021.03.15')
56 #cloud_name = 'openstackL6'
58 #heat_template = 'openstack-rapid.yaml'
59 #heat_param = 'params_rapid.yaml'
61 RapidStackManager.deploy_stack(rapid_stack_params)
63 if __name__ == "__main__":