import yaml
-import logging
-from .common import utils
+from apex.common import utils
+from apex.common import constants
REQ_DEPLOY_SETTINGS = ['sdn_controller',
'odl_version',
VALID_ROLES = ['Controller', 'Compute', 'ObjectStorage']
VALID_PERF_OPTS = ['kernel', 'nova', 'vpp', 'ovs']
VALID_DATAPLANES = ['ovs', 'ovs_dpdk', 'fdio']
+VALID_ODL_VERSIONS = ['carbon', 'nitrogen', 'master']
class DeploySettings(dict):
deployment script move to python.
"""
def __init__(self, filename):
- init_dict = {}
if isinstance(filename, str):
with open(filename, 'r') as deploy_settings_file:
init_dict = yaml.safe_load(deploy_settings_file)
self['deploy_options'][req_set] = 'ovs'
elif req_set == 'ceph':
self['deploy_options'][req_set] = True
+ elif req_set == 'odl_version':
+ self['deploy_options'][req_set] = \
+ constants.DEFAULT_ODL_VERSION
else:
self['deploy_options'][req_set] = False
+ elif req_set == 'odl_version' and self['deploy_options'][
+ 'odl_version'] not in VALID_ODL_VERSIONS:
+ raise DeploySettingsException(
+ "Invalid ODL version: {}".format(self[deploy_options][
+ 'odl_version']))
if 'performance' in deploy_options:
if not isinstance(deploy_options['performance'], dict):
value)
return bash_str
- def dump_bash(self, path=None):
- """
- Prints settings for bash consumption.
-
- If optional path is provided, bash string will be written to the file
- instead of stdout.
- """
- bash_str = ''
- for key, value in self['global_params'].items():
- bash_str += "{}={}\n".format(key, value)
- if 'performance' in self['deploy_options']:
- bash_str += self._dump_performance()
- bash_str += self._dump_deploy_options_array()
- utils.write_str(bash_str, path)
-
class DeploySettingsException(Exception):
def __init__(self, value):