summaryrefslogtreecommitdiffstats
path: root/deploy/scenario/no-ha_heat_ceilometer_scenario_0.0.2.yaml
blob: c21585979a3eaf9527e8703bf7786c9c7a1bf3ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
##############################################################################
# Copyright (c) 2015 Ericsson AB and others.
# jonas.bjurel@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
##############################################################################

############################################################################### # Description:
# This .yaml configuration file defines the configuration of the fuel
# deployment and is passed as an argument to deploy.sh
# eg. deploy.sh -c https://artifact.opnfv.org/fuel/config
# This will make build.sh fetch this configuration file and configure the
# deployment accordingly.
# After the deployment, a copy of this file gets uploaded to fuel:
# /root/deploy-config.yaml, as well as the sha-1 sum of this file:
# /root/deploy-config.sha1
##############################################################################

##############################################################################
# deployment configuration meta-data
deployment-scenario-metadata:
   title: OpenStack-only, No-HA deployment
   version: 0.0.2
   created: Jan 26 2016
   comment: Fuel OpenStack-only with Ceph, Ceilometer and Heat, No-HA deployment rebased with Fuel8

##############################################################################
# Stack extentions are opnfv added value features in form of a fuel-plugin
# plug-ins listed below will be enabled and configured according to the
# <module-config-base-uri>/<module-config-name>_<module-config-version>.yaml
# It does so by copying the config file to the local plugin config directory
stack-extensions:

##############################################################################
# By editing the override-config sections below, you can override arbitrary
# configuration name-space settings
dea-override-config:
  nodes:
  - id: 1
    interfaces: interfaces_1
    role: mongo,controller
    transformations: transformations_1
  - id: 2
    interfaces: interfaces_1
    role: ceph-osd,compute
    transformations: transformations_1
  - id: 3
    interfaces: interfaces_1
    role: ceph-osd,compute
    transformations: transformations_1
  - id: 4
    interfaces: interfaces_1
    role: ceph-osd,compute
    transformations: transformations_1

dha-override-config:
#  disks:
#    contrail: 500G

##############################################################################
# The verification pipeline may populate the section below with arbitrary
# testing information, which post deploy can be retreived from the fuel master:
# /root/deploy-config.yaml
test:
st="lab", help="lab config file") (options, args) = parser.parse_args() scenario = options.scenario labconfig_file = options.lab # # Set Path and configs path # scenarioconfig_file = 'default_deployment_config.yaml' # Capture our current directory jujuver = subprocess.check_output(["juju", "--version"]) if LooseVersion(jujuver) >= LooseVersion('2'): TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/juju2/bundle_tpl' else: TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/bundle_tpl' # # Prepare variables # # Prepare a storage for passwords passwords_store = dict() # # Local Functions # def load_yaml(filepath): """Load YAML file""" with open(filepath, 'r') as stream: try: return yaml.load(stream) except yaml.YAMLError as exc: print(exc) # # Templates functions # def unit_qty(): """Return quantity of units to deploy""" global config if config['os']['ha']['mode'] == 'ha': return config['os']['ha']['cluster_size'] else: return 1 def unit_ceph_qty(): """Return size of the ceph cluster""" global config if config['os']['ha']['mode'] == 'ha': return config['os']['ha']['cluster_size'] else: if config['opnfv']['units'] >= 3: return config['os']['ha']['cluster_size'] else: return 2 def unit_scaleio_qty(): """Return size of the scaleio cluster""" return 3 def to_select(qty=False): """Return a random list of machines numbers to deploy""" global config if not qty: qty = config['os']['ha']['cluster_size'] if \ config['os']['ha']['mode'] == 'ha' else 1 if config['os']['hyperconverged']: return random.sample(range(0, config['opnfv']['units']), qty) else: return random.sample(range(0, qty), qty) def get_password(key, length=16, special=False): """Return a new random password or a already created one""" global passwords_store if key not in passwords_store.keys(): alphabet = "abcdefghijklmnopqrstuvwxyz" upperalphabet = alphabet.upper() char_list = alphabet + upperalphabet + '0123456789' pwlist = [] if special: char_list += "+-,;./:?!*" for i in range(length): pwlist.append(char_list[random.randrange(len(char_list))]) random.shuffle(pwlist) passwords_store[key] = "".join(pwlist) return passwords_store[key] # # Config import # # Load scenario Config config = load_yaml(scenarioconfig_file) # Load lab Config config.update(load_yaml(labconfig_file)) # We transform array to hash for an easier work config['opnfv']['spaces_dict'] = dict() for space in config['opnfv']['spaces']: config['opnfv']['spaces_dict'][space['type']] = space config['opnfv']['storage_dict'] = dict() for storage in config['opnfv']['storage']: config['opnfv']['storage_dict'][storage['type']] = storage # # Parse scenario name # # Set default scenario name if not scenario: scenario = "os-nosdn-nofeature-nonha" # Parse scenario name try: sc = scenario.split('-') (sdn, features, hamode) = sc[1:4] features = features.split('_') if len(sc) > 4: extra = sc[4].split('_') else: extra = [] except ValueError as err: print('Error: Bad scenario name syntax, use ' '"os-<controller>-<nfvfeature>-<mode>[-<extrastuff>]" format') sys.exit(1) # # Update config with scenario name # # change ha mode config['os']['ha']['mode'] = hamode # change ha mode config['os']['network']['controller'] = sdn # Change features if 'lxd' in features: config['os']['lxd'] = True if 'dvr' in features: config['os']['network']['dvr'] = True if 'ipv6' in features: config['os']['network']['ipv6'] = True if 'ovs' in features: config['os']['network']['enhanced_ovs'] = True if 'sfc' in features: config['os']['network']['sfc'] = True if 'dpdk' in features: config['os']['network']['dpdk'] = True if 'bgpvpn' in features: config['os']['network']['bgpvpn'] = True if 'odll3' in features: config['os']['network']['odll3'] = True if 'dishypcon' in features: config['os']['hyperconverged'] = False # Set beta option from extra if 'publicapi' in extra: config['os']['beta']['public_api'] = True if 'radosgwcluster' in extra: config['os']['beta']['hacluster_ceph_radosgw'] = True if 'hugepages' in extra: config['os']['beta']['huge_pages'] = True if 'mitaka' in extra: config['os']['release'] = 'mitaka' if 'trusty' in extra: config['ubuntu']['release'] = 'trusty' if 'liberty' in extra: config['os']['release'] = 'liberty' if 'xenial' in extra: config['ubuntu']['release'] = 'xenial' if 'dishypcon' in extra: config['os']['hyperconverged'] = False # # Transform template to bundle.yaml according to config # # Create the jinja2 environment. env = Environment(loader=FileSystemLoader(TPL_DIR), trim_blocks=True) template = env.get_template('bundle.yaml') # Add functions env.globals.update(get_password=get_password) env.globals.update(unit_qty=unit_qty) env.globals.update(unit_ceph_qty=unit_ceph_qty) env.globals.update(unit_scaleio_qty=unit_scaleio_qty) env.globals.update(to_select=to_select) # Render the template output = template.render(**config) # Check output syntax try: yaml.load(output) except yaml.YAMLError as exc: print(exc) # print output print(output)