diff options
Diffstat (limited to 'deploy')
-rw-r--r-- | deploy/deploy.py | 39 | ||||
-rw-r--r-- | deploy/scenario/ha_nofeature_scenario.yaml | 46 | ||||
-rw-r--r-- | deploy/scenario/ha_odl-l2_nofeatrue_scenario.yaml | 50 | ||||
-rw-r--r-- | deploy/scenario/ha_odl-l3_nofeature_scenario.yaml | 50 | ||||
-rw-r--r-- | deploy/scenario/no-ha_nofeature_scenario.yaml | 42 | ||||
-rw-r--r-- | deploy/scenario/no-ha_odl-l2_nofeature_scenario.yaml | 46 | ||||
-rw-r--r-- | deploy/scenario/no-ha_odl-l3_nofeature_scenario.yaml | 46 | ||||
-rw-r--r-- | deploy/scenario/scenario.yaml | 34 | ||||
-rw-r--r-- | deploy/utils.py | 23 |
9 files changed, 371 insertions, 5 deletions
diff --git a/deploy/deploy.py b/deploy/deploy.py index 5926a74d..88a5cba6 100644 --- a/deploy/deploy.py +++ b/deploy/deploy.py @@ -15,6 +15,7 @@ # [ ] 4. get ipmi user/password from PDF (Pod Descriptor File) # [ ] 5. get pxe bridge from jjb # [ ] 6. enlarge the vm size of Controller & Compute in deploy.yml +# [ ] 7. support scenarios options and configuration ############################################################################## import argparse @@ -36,7 +37,9 @@ from utils import ( check_sudo_privilege, check_file_exists, make_file_executable, - confirm_dir_exists + confirm_dir_exists, + merge_dicts, + check_scenario_valid ) from environment import ( DaisyEnvironment, @@ -46,13 +49,12 @@ from environment import ( class DaisyDeployment(object): def __init__(self, lab_name, pod_name, deploy_file, net_file, bin_file, daisy_only, cleanup_only, remote_dir, work_dir, storage_dir, - pxe_bridge, deploy_log): + pxe_bridge, deploy_log, scenario): self.lab_name = lab_name self.pod_name = pod_name self.deploy_file = deploy_file - with open(deploy_file) as yaml_file: - self.deploy_struct = yaml.safe_load(yaml_file) + self.deploy_struct = self._consturct_final_deploy_conf(deploy_file, scenario) if not cleanup_only: self.net_file = net_file @@ -114,6 +116,27 @@ class DaisyDeployment(object): 'password': password, 'disk_size': disk_size} + def _consturct_final_deploy_conf(self, deploy_file, scenario): + with open(deploy_file) as yaml_file: + deploy_struct = yaml.safe_load(yaml_file) + scenario_file = path_join(WORKSPACE, 'deploy/scenario/scenario.yaml') + with open(scenario_file) as yaml_file: + scenario_trans_conf = yaml.safe_load(yaml_file) + if scenario in scenario_trans_conf: + fin_scenario_file = path_join(WORKSPACE, 'deploy/scenario', + scenario_trans_conf[scenario]['configfile']) + else: + fin_scenario_file = path_join(WORKSPACE, 'deploy/scenario', scenario) + with open(fin_scenario_file) as yaml_file: + deploy_scenario_conf = yaml.safe_load(yaml_file) + deploy_scenario_override_conf = deploy_scenario_conf['deploy-override-config'] + # Only virtual deploy scenarios can override deploy.yml + if deploy_scenario_conf and (deploy_struct['adapter'] == 'libvirt'): + deploy_struct = dict(merge_dicts(deploy_struct, deploy_scenario_override_conf)) + modules = deploy_scenario_conf['stack-extensions'] + deploy_struct['modules'] = modules + return deploy_struct + def run(self): self.daisy_env.delete_old_environment() if self.cleanup_only: @@ -168,6 +191,9 @@ def config_arg_parser(): parser.add_argument('-log', dest='deploy_log', action='store', nargs='?', default=path_join(WORKSPACE, 'deploy.log'), help='Path and name of the deployment log file') + parser.add_argument('-s', dest='scenario', action='store', nargs='?', + default='os-nosdn-nofeature-noha', + help='Deployment scenario') return parser @@ -178,6 +204,8 @@ def parse_arguments(): save_log_to_file(args.deploy_log) LI(args) + check_scenario_valid(args.scenario) + conf_base_dir = path_join(WORKSPACE, 'labs', args.lab_name, args.pod_name) deploy_file = path_join(conf_base_dir, 'daisy/config/deploy.yml') net_file = path_join(conf_base_dir, 'daisy/config/network.yml') @@ -202,7 +230,8 @@ def parse_arguments(): 'work_dir': args.work_dir, 'storage_dir': args.storage_dir, 'pxe_bridge': args.pxe_bridge, - 'deploy_log': args.deploy_log + 'deploy_log': args.deploy_log, + 'scenario': args.scenario } return kwargs diff --git a/deploy/scenario/ha_nofeature_scenario.yaml b/deploy/scenario/ha_nofeature_scenario.yaml new file mode 100644 index 00000000..a3791462 --- /dev/null +++ b/deploy/scenario/ha_nofeature_scenario.yaml @@ -0,0 +1,46 @@ +############################################################################## +# Copyright (c) 2017 ZTE Coreporation and others. +# hu.zhijiang@zte.com.cn +# sun.jing22@zte.com.cn +# 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 +############################################################################## +############################################################################## +# deployment configuration meta-data +deployment-scenario-metadata: + title: OpenStack-only, HA deploymen + version: 0.0.1 + created: Jun 8 2017 + comment: + +############################################################################## +# Stack extentions are opnfv added value features +stack-extensions: + +############################################################################## +# By editing the override-config sections below, you can override arbitrary +# configuration name-space settings +deploy-override-config: + hosts: + - name: 'controller01' + roles: + - 'CONTROLLER_LB' + template: 'templates/virtual_environment/vms/controller.xml' + - name: 'controller02' + roles: + - 'CONTROLLER_LB' + template: 'templates/virtual_environment/vms/controller.xml' + - name: 'controller03' + roles: + - 'CONTROLLER_LB' + template: 'templates/virtual_environment/vms/controller.xml' + - name: 'computer01' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml' + - name: 'computer02' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml'
\ No newline at end of file diff --git a/deploy/scenario/ha_odl-l2_nofeatrue_scenario.yaml b/deploy/scenario/ha_odl-l2_nofeatrue_scenario.yaml new file mode 100644 index 00000000..db0287c8 --- /dev/null +++ b/deploy/scenario/ha_odl-l2_nofeatrue_scenario.yaml @@ -0,0 +1,50 @@ +############################################################################## +# Copyright (c) 2017 ZTE Coreporation and others. +# hu.zhijiang@zte.com.cn +# sun.jing22@zte.com.cn +# 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 +############################################################################## +############################################################################## +# deployment configuration meta-data +deployment-scenario-metadata: + title: ODL-L2 HA deployment + version: 0.0.1 + created: Jun 22 2017 + comment: + +############################################################################## +# Stack extentions are opnfv added value features +stack-extensions: + - module: opendaylight + module-config: + - enable_l3_odl: + value: false + +############################################################################## +# By editing the override-config sections below, you can override arbitrary +# configuration name-space settings +deploy-override-config: + hosts: + - name: 'controller01' + roles: + - 'CONTROLLER_LB' + template: 'templates/virtual_environment/vms/controller.xml' + - name: 'controller02' + roles: + - 'CONTROLLER_LB' + template: 'templates/virtual_environment/vms/controller.xml' + - name: 'controller03' + roles: + - 'CONTROLLER_LB' + template: 'templates/virtual_environment/vms/controller.xml' + - name: 'computer01' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml' + - name: 'computer02' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml'
\ No newline at end of file diff --git a/deploy/scenario/ha_odl-l3_nofeature_scenario.yaml b/deploy/scenario/ha_odl-l3_nofeature_scenario.yaml new file mode 100644 index 00000000..59e16c4f --- /dev/null +++ b/deploy/scenario/ha_odl-l3_nofeature_scenario.yaml @@ -0,0 +1,50 @@ +############################################################################## +# Copyright (c) 2017 ZTE Coreporation and others. +# hu.zhijiang@zte.com.cn +# sun.jing22@zte.com.cn +# 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 +############################################################################## +############################################################################## +# deployment configuration meta-data +deployment-scenario-metadata: + title: ODL-L3 HA deployment + version: 0.0.1 + created: Jun 8 2017 + comment: + +############################################################################## +# Stack extentions are opnfv added value features +stack-extensions: + - module: opendaylight + module-config: + - enable_l3_odl: + value: true + +############################################################################## +# By editing the override-config sections below, you can override arbitrary +# configuration name-space settings +deploy-override-config: + hosts: + - name: 'controller01' + roles: + - 'CONTROLLER_LB' + template: 'templates/virtual_environment/vms/controller.xml' + - name: 'controller02' + roles: + - 'CONTROLLER_LB' + template: 'templates/virtual_environment/vms/controller.xml' + - name: 'controller03' + roles: + - 'CONTROLLER_LB' + template: 'templates/virtual_environment/vms/controller.xml' + - name: 'computer01' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml' + - name: 'computer02' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml'
\ No newline at end of file diff --git a/deploy/scenario/no-ha_nofeature_scenario.yaml b/deploy/scenario/no-ha_nofeature_scenario.yaml new file mode 100644 index 00000000..f959234b --- /dev/null +++ b/deploy/scenario/no-ha_nofeature_scenario.yaml @@ -0,0 +1,42 @@ +############################################################################## +# Copyright (c) 2017 ZTE Coreporation and others. +# hu.zhijiang@zte.com.cn +# sun.jing22@zte.com.cn +# 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 +############################################################################## +############################################################################## +# deployment configuration meta-data +deployment-scenario-metadata: + title: OpenStack-only, NO-HA deploymen + version: 0.0.1 + created: Jun 8 2017 + comment: + +############################################################################## +# Stack extentions are opnfv added value features +stack-extensions: + +############################################################################## +# By editing the override-config sections below, you can override arbitrary +# configuration name-space settings +deploy-override-config: + hosts: + - name: 'controller01' + roles: + - 'CONTROLLER_LB' + template: 'templates/virtual_environment/vms/controller.xml' + - name: 'computer01' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml' + - name: 'computer02' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml' + - name: 'computer03' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml'
\ No newline at end of file diff --git a/deploy/scenario/no-ha_odl-l2_nofeature_scenario.yaml b/deploy/scenario/no-ha_odl-l2_nofeature_scenario.yaml new file mode 100644 index 00000000..12cfc748 --- /dev/null +++ b/deploy/scenario/no-ha_odl-l2_nofeature_scenario.yaml @@ -0,0 +1,46 @@ +############################################################################## +# Copyright (c) 2017 ZTE Coreporation and others. +# hu.zhijiang@zte.com.cn +# sun.jing22@zte.com.cn +# 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 +############################################################################## +############################################################################## +# deployment configuration meta-data +deployment-scenario-metadata: + title: ODL-L2 NO-HA deployment + version: 0.0.1 + created: Jun 22 2017 + comment: + +############################################################################## +# Stack extentions are opnfv added value features +stack-extensions: + - module: opendaylight + module-config: + - enable_l3_odl: + value: false + +############################################################################## +# By editing the override-config sections below, you can override arbitrary +# configuration name-space settings +deploy-override-config: + hosts: + - name: 'controller01' + roles: + - 'CONTROLLER_LB' + template: 'templates/virtual_environment/vms/controller.xml' + - name: 'computer01' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml' + - name: 'computer02' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml' + - name: 'computer03' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml'
\ No newline at end of file diff --git a/deploy/scenario/no-ha_odl-l3_nofeature_scenario.yaml b/deploy/scenario/no-ha_odl-l3_nofeature_scenario.yaml new file mode 100644 index 00000000..e91acc6f --- /dev/null +++ b/deploy/scenario/no-ha_odl-l3_nofeature_scenario.yaml @@ -0,0 +1,46 @@ +############################################################################## +# Copyright (c) 2017 ZTE Coreporation and others. +# hu.zhijiang@zte.com.cn +# sun.jing22@zte.com.cn +# 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 +############################################################################## +############################################################################## +# deployment configuration meta-data +deployment-scenario-metadata: + title: ODL-L3 NO-HA deployment + version: 0.0.1 + created: Jun 8 2017 + comment: + +############################################################################## +# Stack extentions are opnfv added value features +stack-extensions: + - module: opendaylight + module-config: + - enable_l3_odl: + value: true + +############################################################################## +# By editing the override-config sections below, you can override arbitrary +# configuration name-space settings +deploy-override-config: + hosts: + - name: 'controller01' + roles: + - 'CONTROLLER_LB' + template: 'templates/virtual_environment/vms/controller.xml' + - name: 'computer01' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml' + - name: 'computer02' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml' + - name: 'computer03' + roles: + - 'COMPUTER' + template: 'templates/virtual_environment/vms/computer.xml'
\ No newline at end of file diff --git a/deploy/scenario/scenario.yaml b/deploy/scenario/scenario.yaml new file mode 100644 index 00000000..81862485 --- /dev/null +++ b/deploy/scenario/scenario.yaml @@ -0,0 +1,34 @@ +############################################################################## +# Copyright (c) 2017 ZTE Coreporation and others. +# hu.zhijiang@zte.com.cn +# sun.jing22@zte.com.cn +# 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 +############################################################################## +############################################################################## +# Short scenario name convention to be followed: +# os-<controller>-<feature>-<mode>[-<optional-parameter>] +# controler: nosdn|odl|onos|ocl|... +# feaure: nofeature | [vlan]_[kvm]_[ovs]_[vlan]_.... +# mode: ha|noha +############################################################################## + +os-nosdn-nofeature-ha: + configfile: ha_nofeature_scenario.yaml + +os-nosdn-nofeature-noha: + configfile: no-ha_nofeature_scenario.yaml + +os-odl_l3-nofeature-ha: + configfile: ha_odl-l3_nofeature_scenario.yaml + +os-odl_l3-nofeature-noha: + configfile: no-ha_odl-l3_nofeature_scenario.yaml + +os-odl_l2-nofeature-ha: + configfile: ha_odl-l2_nofeature_scenario.yaml + +os-odl_l2-nofeature-noha: + configfile: no-ha_odl-l2_nofeature_scenario.yaml
\ No newline at end of file diff --git a/deploy/utils.py b/deploy/utils.py index 0c5b1370..102ae1f3 100644 --- a/deploy/utils.py +++ b/deploy/utils.py @@ -19,6 +19,9 @@ path_join = os.path.join CWD = os.getcwd() WORKSPACE = os.path.normpath(path_join(os.path.dirname(__file__), '..')) BASE = CWD +valid_scenario_list = ['os-nosdn-nofeature-noha', + 'os-odl_l3-nofeature-noha', + 'os-odl_l2-nofeature-noha'] def get_logger(): @@ -136,3 +139,23 @@ def run_shell(cmd, check=False): LI('Successful command: ' + str(cmd)) return return_code + + +def merge_dicts(dict1, dict2): + for k in set(dict1).union(dict2): + if k in dict1 and k in dict2: + if isinstance(dict1[k], dict) and isinstance(dict2[k], dict): + yield (k, dict(merge_dicts(dict1[k], dict2[k]))) + continue + # If one of the values is not a dict nor a list, + # you can't continue merging it. + # Value from second dict overrides one in first if exists. + if k in dict2: + yield (k, dict2[k]) + else: + yield (k, dict1[k]) + + +def check_scenario_valid(scenario): + if not (scenario in valid_scenario_list): + err_exit('Invald scenario:%s' % scenario) |