Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 1 | # Copyright 2016 Mirantis, Inc. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | import copy |
| 15 | import os |
| 16 | import pkg_resources |
| 17 | |
| 18 | from oslo_config import cfg |
| 19 | from oslo_config import generator |
| 20 | |
| 21 | from tcp_tests.helpers import ext |
| 22 | from tcp_tests.helpers import oslo_cfg_types as ct |
| 23 | from tcp_tests import settings |
| 24 | |
Dennis Dmitriev | 9b02c8b | 2017-11-13 15:31:35 +0200 | [diff] [blame] | 25 | print("\n" + "-" * 10 + " Initialize oslo.config variables with defaults" |
| 26 | " from environment" + "-" * 10) |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 27 | |
| 28 | _default_conf = pkg_resources.resource_filename( |
Dennis Dmitriev | ab83ea4 | 2017-05-12 16:52:45 +0300 | [diff] [blame] | 29 | __name__, 'templates/{0}/underlay.yaml'.format(settings.LAB_CONFIG_NAME)) |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 30 | |
| 31 | _default_salt_steps = pkg_resources.resource_filename( |
Dennis Dmitriev | ab83ea4 | 2017-05-12 16:52:45 +0300 | [diff] [blame] | 32 | __name__, 'templates/{0}/salt.yaml'.format(settings.LAB_CONFIG_NAME)) |
Dennis Dmitriev | 9dada8a | 2017-08-30 17:38:55 +0300 | [diff] [blame] | 33 | _default_environment_template_dir = pkg_resources.resource_filename( |
| 34 | __name__, 'environment/') |
Dmitry Tyzhnenko | 8f6a63e | 2017-09-05 15:37:23 +0300 | [diff] [blame] | 35 | _default_templates_dir = pkg_resources.resource_filename( |
| 36 | __name__, 'templates/') |
Dennis Dmitriev | ea48cf5 | 2018-07-18 18:04:39 +0300 | [diff] [blame] | 37 | _default_core_steps = pkg_resources.resource_filename( |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 38 | __name__, |
Dennis Dmitriev | ea48cf5 | 2018-07-18 18:04:39 +0300 | [diff] [blame] | 39 | 'templates/{0}/core.yaml'.format( |
Dennis Dmitriev | 2a13a13 | 2016-11-04 00:56:23 +0200 | [diff] [blame] | 40 | settings.LAB_CONFIG_NAME)) |
Dennis Dmitriev | eac3aab | 2017-07-12 16:36:41 +0300 | [diff] [blame] | 41 | _default_oss_steps = pkg_resources.resource_filename( |
| 42 | __name__, |
| 43 | 'templates/{0}/oss.yaml'.format( |
| 44 | settings.LAB_CONFIG_NAME)) |
sgudz | b67ce73 | 2018-02-13 17:58:31 +0200 | [diff] [blame] | 45 | _default_drivetrain_steps = pkg_resources.resource_filename( |
| 46 | __name__, |
| 47 | 'templates/{0}/drivetrain.yaml'.format( |
| 48 | settings.LAB_CONFIG_NAME)) |
Dennis Dmitriev | f3f90a5 | 2017-08-10 14:37:05 +0300 | [diff] [blame] | 49 | _default_decapod_steps = pkg_resources.resource_filename( |
| 50 | __name__, |
| 51 | 'templates/{0}/decapod.yaml'.format( |
| 52 | settings.LAB_CONFIG_NAME)) |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 53 | _default_openstack_steps = pkg_resources.resource_filename( |
Dennis Dmitriev | ab83ea4 | 2017-05-12 16:52:45 +0300 | [diff] [blame] | 54 | __name__, 'templates/{0}/openstack.yaml'.format( |
Dennis Dmitriev | 2a13a13 | 2016-11-04 00:56:23 +0200 | [diff] [blame] | 55 | settings.LAB_CONFIG_NAME)) |
Dina Belova | e6fdffb | 2017-09-19 13:58:34 -0700 | [diff] [blame] | 56 | _default_opencontrail_prepare_tests_steps_path = \ |
| 57 | pkg_resources.resource_filename( |
| 58 | __name__, 'templates/{0}/opencontrail.yaml'.format( |
| 59 | settings.LAB_CONFIG_NAME)) |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 60 | _default_sl_prepare_tests_steps_path = pkg_resources.resource_filename( |
| 61 | __name__, 'templates/{0}/sl.yaml'.format( |
| 62 | settings.LAB_CONFIG_NAME)) |
Tatyana Leontovich | 460f7df | 2017-11-13 15:45:06 +0200 | [diff] [blame] | 63 | _default_ceph_prepare_tests_steps_path = pkg_resources.resource_filename( |
| 64 | __name__, 'templates/{0}/ceph.yaml'.format( |
| 65 | settings.LAB_CONFIG_NAME)) |
Artem Panchenko | 0594cd7 | 2017-06-12 13:25:26 +0300 | [diff] [blame] | 66 | _default_k8s_steps = pkg_resources.resource_filename( |
| 67 | __name__, 'templates/{0}/k8s.yaml'.format( |
| 68 | settings.LAB_CONFIG_NAME)) |
Vladimir Jigulin | 62bcf46 | 2018-05-28 18:17:01 +0400 | [diff] [blame] | 69 | _default_k8s_update_steps = pkg_resources.resource_filename( |
| 70 | __name__, 'templates/{0}/k8s-update.yaml'.format( |
| 71 | settings.LAB_CONFIG_NAME)) |
Dmitry Tyzhnenko | b864183 | 2017-11-07 17:02:47 +0200 | [diff] [blame] | 72 | _default_net_mgm = os.environ.get("NET_MGMT", "admin-pool01") |
Dmitry Tyzhnenko | 35413c0 | 2018-03-05 14:12:37 +0200 | [diff] [blame] | 73 | _default_configure_steps = pkg_resources.resource_filename( |
| 74 | __name__, 'templates/{0}/cfg01_configure.yaml'.format( |
| 75 | settings.LAB_CONFIG_NAME)) |
| 76 | # _default_cluster_maas_config = pkg_resources.resource_filename( |
| 77 | # __name__, 'templates/{0}/cluster_infra_maas.yml'.format( |
| 78 | # settings.LAB_CONFIG_NAME)) |
| 79 | _default_cluster_maas_config = 'cluster_infra_maas.yml' |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 80 | |
| 81 | hardware_opts = [ |
| 82 | ct.Cfg('manager', ct.String(), |
| 83 | help="Hardware manager name", default="devops"), |
| 84 | ct.Cfg('conf_path', ct.String(), |
| 85 | help="Hardware config file", default=_default_conf), |
| 86 | ct.Cfg('current_snapshot', ct.String(), |
| 87 | help="Latest environment status name", |
| 88 | default=ext.SNAPSHOT.hardware), |
| 89 | ] |
| 90 | |
| 91 | |
| 92 | underlay_opts = [ |
| 93 | ct.Cfg('ssh', ct.JSONList(), |
| 94 | help="""SSH Settings for Underlay: [{ |
| 95 | 'node_name': node1, |
Dennis Dmitriev | 23e5d19 | 2016-10-31 11:27:10 +0200 | [diff] [blame] | 96 | 'roles': ['salt-master', 'salt-minion', ], |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 97 | 'host': hostname, |
| 98 | 'login': login, |
| 99 | 'password': password, |
| 100 | 'address_pool': (optional), |
| 101 | 'port': (optional), |
| 102 | 'keys': [(optional)], |
| 103 | }, ...]""", default=[]), |
| 104 | ct.Cfg('roles', ct.JSONList(), |
| 105 | help="Node roles managed by underlay in the environment", |
Dennis Dmitriev | 53d3b77 | 2016-10-18 14:31:58 +0300 | [diff] [blame] | 106 | default=[ext.UNDERLAY_NODE_ROLES.salt_master, |
vrovachev | 99228d3 | 2017-06-08 19:46:10 +0400 | [diff] [blame] | 107 | ext.UNDERLAY_NODE_ROLES.salt_minion, |
Victor Ryzhenkin | 66d3937 | 2017-09-28 19:25:48 +0400 | [diff] [blame] | 108 | ext.UNDERLAY_NODE_ROLES.k8s_controller]), |
Dennis Dmitriev | 7b9538f | 2017-05-15 17:01:34 +0300 | [diff] [blame] | 109 | ct.Cfg('bootstrap_timeout', ct.Integer(), |
| 110 | help="Timeout of waiting SSH for nodes with specified roles", |
Dennis Dmitriev | 4558ee9 | 2018-01-31 08:14:08 -0400 | [diff] [blame] | 111 | default=600), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 112 | ct.Cfg('nameservers', ct.JSONList(), |
| 113 | help="IP addresses of DNS servers", |
| 114 | default=[]), |
| 115 | ct.Cfg('upstream_dns_servers', ct.JSONList(), |
| 116 | help="IP addresses of upstream DNS servers (dnsmasq)", |
| 117 | default=[]), |
| 118 | ct.Cfg('lvm', ct.JSONDict(), |
| 119 | help="LVM settings for Underlay", default={}), |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 120 | ct.Cfg('address_pools', ct.JSONDict(), |
| 121 | help="""Address pools (dynamically) allocated for the environment. |
| 122 | May be used to determine CIDR for a specific network from |
| 123 | tests or during the deployment process. |
| 124 | {'pool_name1': '<cidr>', 'pool_name2': '<cidr>', ...}""", |
| 125 | default={}), |
Artem Panchenko | db0a97f | 2017-06-27 19:09:13 +0300 | [diff] [blame] | 126 | ct.Cfg('ssh_keys', ct.JSONList(), default=[], |
| 127 | help="SSH key pair(s) for root. If the option is left empty, " |
| 128 | "then a key pair will be generated automatically"), |
| 129 | ct.Cfg('ssh_key_file', ct.String(), default=os.path.abspath('./id_rsa'), |
| 130 | help='Path (local) to file with private key authorized on nodes'), |
Dmitry Tyzhnenko | b864183 | 2017-11-07 17:02:47 +0200 | [diff] [blame] | 131 | ct.Cfg('net_mgmt', ct.String(), default=_default_net_mgm) |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 132 | ] |
| 133 | |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 134 | |
| 135 | salt_deploy_opts = [ |
| 136 | ct.Cfg('salt_steps_path', ct.String(), |
| 137 | help="Path to YAML with steps to deploy salt", |
| 138 | default=_default_salt_steps), |
Dennis Dmitriev | 9dada8a | 2017-08-30 17:38:55 +0300 | [diff] [blame] | 139 | ct.Cfg('environment_template_dir', ct.String(), |
| 140 | help="Path to directory with Environment template and inventory", |
| 141 | default=_default_environment_template_dir), |
Dmitry Tyzhnenko | 8f6a63e | 2017-09-05 15:37:23 +0300 | [diff] [blame] | 142 | ct.Cfg('templates_dir', ct.String(), |
| 143 | help="Path to directory with templates", |
| 144 | default=_default_templates_dir), |
Dennis Dmitriev | 5bcbdc5 | 2018-03-23 18:05:10 +0200 | [diff] [blame] | 145 | ct.Cfg('salt_roles', ct.JSONList(), |
| 146 | help="Node roles to install salt-minions and manage by salt", |
| 147 | default=[ext.UNDERLAY_NODE_ROLES.salt_master, |
| 148 | ext.UNDERLAY_NODE_ROLES.salt_minion, |
| 149 | ext.UNDERLAY_NODE_ROLES.k8s_controller]), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 150 | ] |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 151 | salt_opts = [ |
| 152 | ct.Cfg('salt_master_host', ct.IPAddress(), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 153 | help="", default='0.0.0.0'), |
Dennis Dmitriev | 2d60c8e | 2017-05-12 18:34:01 +0300 | [diff] [blame] | 154 | ct.Cfg('salt_master_port', ct.String(), |
| 155 | help="", default='6969'), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 156 | ] |
| 157 | |
Dennis Dmitriev | ea48cf5 | 2018-07-18 18:04:39 +0300 | [diff] [blame] | 158 | core_deploy_opts = [ |
| 159 | ct.Cfg('core_steps_path', ct.String(), |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 160 | help="Path to YAML with steps to deploy common services", |
Dennis Dmitriev | ea48cf5 | 2018-07-18 18:04:39 +0300 | [diff] [blame] | 161 | default=_default_core_steps), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 162 | ] |
| 163 | |
Dennis Dmitriev | ea48cf5 | 2018-07-18 18:04:39 +0300 | [diff] [blame] | 164 | core_opts = [ |
| 165 | ct.Cfg('core_installed', ct.Boolean(), |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 166 | help="", default=False), |
| 167 | ] |
| 168 | |
Dennis Dmitriev | eac3aab | 2017-07-12 16:36:41 +0300 | [diff] [blame] | 169 | oss_deploy_opts = [ |
| 170 | ct.Cfg('oss_steps_path', ct.String(), |
| 171 | help="Path to YAML with steps to deploy OSS Tools", |
| 172 | default=_default_oss_steps), |
| 173 | ] |
| 174 | |
| 175 | oss_opts = [ |
| 176 | ct.Cfg('oss_installed', ct.Boolean(), |
| 177 | help="", default=False), |
| 178 | ] |
| 179 | |
sgudz | b67ce73 | 2018-02-13 17:58:31 +0200 | [diff] [blame] | 180 | drivetrain_deploy_opts = [ |
| 181 | ct.Cfg('drivetrain_steps_path', ct.String(), |
| 182 | help="Path to YAML with steps to deploy Drivetrain", |
| 183 | default=_default_drivetrain_steps), |
| 184 | ] |
| 185 | |
| 186 | drivetrain_opts = [ |
| 187 | ct.Cfg('drivetrain_installed', ct.Boolean(), |
| 188 | help="", default=False), |
| 189 | ] |
| 190 | |
Dennis Dmitriev | f3f90a5 | 2017-08-10 14:37:05 +0300 | [diff] [blame] | 191 | decapod_deploy_opts = [ |
| 192 | ct.Cfg('decapod_steps_path', ct.String(), |
| 193 | help="Path to YAML with steps to deploy Ceph with Decapod", |
| 194 | default=_default_decapod_steps), |
| 195 | ] |
| 196 | |
| 197 | decapod_opts = [ |
| 198 | ct.Cfg('decapod_installed', ct.Boolean(), |
| 199 | help="", default=False), |
| 200 | ] |
| 201 | |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 202 | openstack_deploy_opts = [ |
| 203 | ct.Cfg('openstack_steps_path', ct.String(), |
| 204 | help="Path to YAML with steps to deploy openstack", |
| 205 | default=_default_openstack_steps), |
Tatyana Leontovich | c72604d | 2018-01-04 17:58:00 +0200 | [diff] [blame] | 206 | ct.Cfg('horizon_host', ct.IPAddress(), |
| 207 | help="", default='0.0.0.0'), |
| 208 | ct.Cfg('horizon_port', ct.String(), |
| 209 | help="", default='5000'), |
| 210 | ct.Cfg('horizon_user', ct.String(), |
| 211 | help="", default='admin'), |
| 212 | ct.Cfg('horizon_password', ct.String(), |
| 213 | help="", default='workshop'), |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 214 | ] |
| 215 | openstack_opts = [ |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 216 | ct.Cfg('openstack_installed', ct.Boolean(), |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 217 | help="", default=False), |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 218 | ct.Cfg('openstack_keystone_endpoint', ct.String(), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 219 | help="", default=''), |
Tatyana Leontovich | c08a54b | 2018-04-19 02:21:25 +0300 | [diff] [blame] | 220 | ct.Cfg('horizon_check', ct.Boolean(), |
Tatyana Leontovich | 6970071 | 2018-04-23 12:26:57 +0300 | [diff] [blame] | 221 | help="", default=False), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 222 | ] |
| 223 | |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 224 | opencontrail_opts = [ |
| 225 | ct.Cfg('opencontrail_tags', ct.String(), |
| 226 | help="", default=''), |
| 227 | ct.Cfg('opencontrail_features', ct.String(), |
| 228 | help="", default=''), |
| 229 | ct.Cfg('opencontrail_prepare_tests_steps_path', ct.String(), |
| 230 | help="Path to YAML with steps to prepare contrail-tests", |
| 231 | default=_default_opencontrail_prepare_tests_steps_path), |
| 232 | ] |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 233 | |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 234 | sl_deploy_opts = [ |
| 235 | ct.Cfg('sl_steps_path', ct.String(), |
| 236 | help="Path to YAML with steps to deploy sl", |
| 237 | default=_default_sl_prepare_tests_steps_path), |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 238 | ct.Cfg('docker_image_alertmanager', ct.String(), |
Dennis Dmitriev | 257a938 | 2018-02-15 04:00:46 +0200 | [diff] [blame] | 239 | default='{0}/openstack-docker/alertmanager:{1}'.format( |
| 240 | settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)), |
Dmitry Kalashnik | 3eee60b | 2018-05-29 17:19:31 +0400 | [diff] [blame] | 241 | ct.Cfg('docker_image_alerta', ct.String(), |
| 242 | default='{0}/mirantis/external/alerta-web:{1}'.format( |
| 243 | settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)), |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 244 | ct.Cfg('docker_image_pushgateway', ct.String(), |
Dennis Dmitriev | 257a938 | 2018-02-15 04:00:46 +0200 | [diff] [blame] | 245 | default='{0}/openstack-docker/pushgateway:{1}'.format( |
| 246 | settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)), |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 247 | ct.Cfg('docker_image_prometheus', ct.String(), |
Dennis Dmitriev | 257a938 | 2018-02-15 04:00:46 +0200 | [diff] [blame] | 248 | default='{0}/openstack-docker/prometheus:{1}'.format( |
| 249 | settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)), |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 250 | ct.Cfg('docker_image_remote_agent', ct.String(), |
Dennis Dmitriev | 257a938 | 2018-02-15 04:00:46 +0200 | [diff] [blame] | 251 | default='{0}/openstack-docker/telegraf:{1}'.format( |
| 252 | settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)), |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 253 | ct.Cfg('docker_image_remote_storage_adapter', ct.String(), |
Dennis Dmitriev | 257a938 | 2018-02-15 04:00:46 +0200 | [diff] [blame] | 254 | default='{0}/openstack-docker/remote_storage_adapter:{1}'.format( |
| 255 | settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)), |
| 256 | ct.Cfg('docker_image_prometheus_relay', ct.String(), |
| 257 | default='{0}/openstack-docker/prometheus_relay:{1}'.format( |
| 258 | settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)), |
| 259 | ct.Cfg('docker_image_grafana', ct.String(), |
| 260 | default='{0}/mirantis/external/grafana:{1}'.format( |
| 261 | settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)), |
Dennis Dmitriev | 86f63e8 | 2017-11-09 00:07:45 +0200 | [diff] [blame] | 262 | # SalesForce connection options for pushkin |
Dennis Dmitriev | ce5ed8b | 2017-11-09 00:44:19 +0200 | [diff] [blame] | 263 | ct.Cfg('sfdc_sandbox_enabled', ct.String(), default='False'), |
Dennis Dmitriev | 86f63e8 | 2017-11-09 00:07:45 +0200 | [diff] [blame] | 264 | ct.Cfg('sfdc_auth_url', ct.String(), default=''), |
| 265 | ct.Cfg('sfdc_username', ct.String(), default=''), |
| 266 | ct.Cfg('sfdc_password', ct.String(), default=''), |
| 267 | ct.Cfg('sfdc_consumer_key', ct.String(), default=''), |
| 268 | ct.Cfg('sfdc_consumer_secret', ct.String(), default=''), |
| 269 | ct.Cfg('sfdc_organization_id', ct.String(), default=''), |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 270 | ] |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 271 | |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 272 | sl_opts = [ |
Dennis Dmitriev | fde667f | 2018-07-23 16:26:50 +0300 | [diff] [blame] | 273 | ct.Cfg('stacklight_installed', ct.Boolean(), |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 274 | help="", default=False), |
sgudz | bf4de57 | 2017-11-23 14:37:01 +0200 | [diff] [blame] | 275 | ct.Cfg('sl_version', ct.String(), |
| 276 | help="StackLight version. Could be 1 or 2", default=''), |
Tatyana Leontovich | 09b7b01 | 2017-07-10 12:53:45 +0300 | [diff] [blame] | 277 | ct.Cfg('sl_vip_host', ct.IPAddress(), |
| 278 | help="Vip address for SL services", default='0.0.0.0'), |
| 279 | ct.Cfg('sl_prometheus_port', ct.String(), |
| 280 | help="Prometheus port", default='15010'), |
| 281 | ct.Cfg('sl_prometheus_proto', ct.String(), |
| 282 | help="Proemtheus protocol", default='http'), |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 283 | ] |
| 284 | |
Tatyana Leontovich | 460f7df | 2017-11-13 15:45:06 +0200 | [diff] [blame] | 285 | ceph_deploy_opts = [ |
| 286 | ct.Cfg('ceph_steps_path', ct.String(), |
| 287 | help="Path to YAML with steps to deploy sl", |
Tatyana Leontovich | a754ce5 | 2017-11-13 16:46:43 +0200 | [diff] [blame] | 288 | default=_default_ceph_prepare_tests_steps_path), |
Tatyana Leontovich | 460f7df | 2017-11-13 15:45:06 +0200 | [diff] [blame] | 289 | ] |
| 290 | |
| 291 | ceph_opts = [ |
Tatyana Leontovich | a754ce5 | 2017-11-13 16:46:43 +0200 | [diff] [blame] | 292 | ct.Cfg('ceph_installed', ct.Boolean(), |
Tatyana Leontovich | 460f7df | 2017-11-13 15:45:06 +0200 | [diff] [blame] | 293 | help="", default=False), |
Tatyana Leontovich | 460f7df | 2017-11-13 15:45:06 +0200 | [diff] [blame] | 294 | ] |
| 295 | |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 296 | k8s_deploy_opts = [ |
Artem Panchenko | 0594cd7 | 2017-06-12 13:25:26 +0300 | [diff] [blame] | 297 | ct.Cfg('k8s_steps_path', ct.String(), |
| 298 | help="Path to YAML with steps to deploy Kubernetes", |
| 299 | default=_default_k8s_steps), |
Vladimir Jigulin | 62bcf46 | 2018-05-28 18:17:01 +0400 | [diff] [blame] | 300 | ct.Cfg('k8s_update_steps_path', ct.String(), |
| 301 | help="Path to YAML with steps to update Kubernetes", |
| 302 | default=_default_k8s_update_steps), |
Artem Panchenko | 0594cd7 | 2017-06-12 13:25:26 +0300 | [diff] [blame] | 303 | ct.Cfg('kubernetes_admin_user', ct.String(), default='admin'), |
| 304 | ct.Cfg('kubernetes_admin_password', ct.String(), |
| 305 | default='sbPfel23ZigJF3Bm'), |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 306 | ct.Cfg('kubernetes_docker_package', ct.String(), default=''), |
| 307 | ct.Cfg('kubernetes_hyperkube_image', ct.String(), |
Victor Ryzhenkin | 92e451e | 2018-06-19 20:01:16 +0400 | [diff] [blame] | 308 | default='{}/mirantis/kubernetes/hyperkube-amd64:v1.10.4-4'.format( |
Victor Ryzhenkin | 2687fa1 | 2018-05-24 16:28:17 +0400 | [diff] [blame] | 309 | settings.DOCKER_REGISTRY)), |
| 310 | ct.Cfg('kubernetes_pause_image', ct.String(), |
Victor Ryzhenkin | 92e451e | 2018-06-19 20:01:16 +0400 | [diff] [blame] | 311 | default='{}/mirantis/kubernetes/pause-amd64:v1.10.4-4'.format( |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 312 | settings.DOCKER_REGISTRY)), |
| 313 | ct.Cfg('kubernetes_calico_image', ct.String(), |
Aleksei Kasatkin | 1d252f0 | 2018-08-29 13:15:58 +0200 | [diff] [blame] | 314 | default='{}/mirantis/projectcalico/calico/node:v3.1.3'.format( |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 315 | settings.DOCKER_REGISTRY)), |
Victor Ryzhenkin | 53f1b49 | 2018-05-09 17:30:17 +0400 | [diff] [blame] | 316 | ct.Cfg('kubernetes_calico_calicoctl_image', ct.String(), |
Aleksei Kasatkin | 1d252f0 | 2018-08-29 13:15:58 +0200 | [diff] [blame] | 317 | default='{}/mirantis/projectcalico/calico/ctl:v3.1.3'.format( |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 318 | settings.DOCKER_REGISTRY)), |
| 319 | ct.Cfg('kubernetes_calico_cni_image', ct.String(), |
Aleksei Kasatkin | 1d252f0 | 2018-08-29 13:15:58 +0200 | [diff] [blame] | 320 | default='{}/mirantis/projectcalico/calico/cni:v3.1.3'.format( |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 321 | settings.DOCKER_REGISTRY)), |
Aleksei Kasatkin | 1d252f0 | 2018-08-29 13:15:58 +0200 | [diff] [blame] | 322 | ct.Cfg('kubernetes_calico_kube_controllers_image', ct.String(), |
| 323 | default='{}/mirantis/projectcalico/calico/kube-controllers:' |
| 324 | 'v3.1.3'.format(settings.DOCKER_REGISTRY)), |
Artem Panchenko | 0594cd7 | 2017-06-12 13:25:26 +0300 | [diff] [blame] | 325 | ct.Cfg('kubernetes_netchecker_enabled', ct.Boolean(), |
| 326 | help="", default=True), |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 327 | ct.Cfg('kubernetes_netchecker_agent_image', ct.String(), |
Aleksei Kasatkin | 593596f | 2018-05-14 11:02:19 +0200 | [diff] [blame] | 328 | default='mirantis/k8s-netchecker-agent:v1.2.2'), |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 329 | ct.Cfg('kubernetes_netchecker_server_image', ct.String(), |
Aleksei Kasatkin | 593596f | 2018-05-14 11:02:19 +0200 | [diff] [blame] | 330 | default='mirantis/k8s-netchecker-server:v1.2.2'), |
Artem Panchenko | 501e67e | 2017-06-14 14:59:18 +0300 | [diff] [blame] | 331 | ct.Cfg('kubernetes_calico_policy_enabled', ct.Boolean(), |
| 332 | help="", default=False), |
Artem Panchenko | 501e67e | 2017-06-14 14:59:18 +0300 | [diff] [blame] | 333 | ct.Cfg('kubernetes_helm_enabled', ct.Boolean(), |
Tatyana Leontovich | 038dc7d | 2017-09-22 16:25:59 +0300 | [diff] [blame] | 334 | help="", default=False), |
Victor Ryzhenkin | 0bf0bb0 | 2017-07-06 18:57:05 +0400 | [diff] [blame] | 335 | ct.Cfg('kubernetes_virtlet_enabled', ct.Boolean(), |
Tatyana Leontovich | 038dc7d | 2017-09-22 16:25:59 +0300 | [diff] [blame] | 336 | help="", default=False), |
Victor Ryzhenkin | 0bf0bb0 | 2017-07-06 18:57:05 +0400 | [diff] [blame] | 337 | ct.Cfg('kubernetes_virtlet_image', ct.String(), |
Victor Ryzhenkin | 92e451e | 2018-06-19 20:01:16 +0400 | [diff] [blame] | 338 | help="", default='mirantis/virtlet:v1.1.0'), |
Victor Ryzhenkin | 14354ac | 2017-09-27 17:42:30 +0400 | [diff] [blame] | 339 | ct.Cfg('kubernetes_externaldns_enabled', ct.Boolean(), |
| 340 | help="", default=False), |
| 341 | ct.Cfg('kubernetes_externaldns_image', ct.String(), |
| 342 | help="", default='mirantis/external-dns:latest'), |
| 343 | ct.Cfg('kubernetes_externaldns_provider', ct.String(), |
| 344 | help="", default='coredns'), |
| 345 | ct.Cfg('kubernetes_coredns_enabled', ct.Boolean(), |
Victor Ryzhenkin | 2a5806e | 2017-12-18 20:23:53 +0400 | [diff] [blame] | 346 | help="", default=False), |
Vladimir Jigulin | a6b018b | 2018-07-18 15:19:01 +0400 | [diff] [blame] | 347 | ct.Cfg('kubernetes_metallb_enabled', ct.Boolean(), |
| 348 | help="", default=False), |
Victor Ryzhenkin | 2a5806e | 2017-12-18 20:23:53 +0400 | [diff] [blame] | 349 | ct.Cfg('kubelet_fail_on_swap', ct.Boolean(), |
Victor Ryzhenkin | 14354ac | 2017-09-27 17:42:30 +0400 | [diff] [blame] | 350 | help="", default=False) |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 351 | ] |
| 352 | |
| 353 | k8s_opts = [ |
Artem Panchenko | 0594cd7 | 2017-06-12 13:25:26 +0300 | [diff] [blame] | 354 | ct.Cfg('k8s_installed', ct.Boolean(), |
| 355 | help="", default=False), |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 356 | ct.Cfg('kube_host', ct.IPAddress(), |
| 357 | help="", default='0.0.0.0'), |
| 358 | ct.Cfg('kube_apiserver_port', ct.Integer(), |
| 359 | help="", default=443), |
vrovachev | a9d0833 | 2017-06-22 20:01:59 +0400 | [diff] [blame] | 360 | ct.Cfg("k8s_conformance_run", ct.Boolean(), |
| 361 | default=False), |
Victor Ryzhenkin | 8ff3c3f | 2018-01-17 19:37:05 +0400 | [diff] [blame] | 362 | ct.Cfg("run_extended_virtlet_conformance", ct.Boolean(), |
| 363 | default=False), |
vrovachev | a9d0833 | 2017-06-22 20:01:59 +0400 | [diff] [blame] | 364 | ct.Cfg('k8s_conformance_image', ct.String(), |
Dennis Dmitriev | 75776c5 | 2017-12-26 18:22:53 +0200 | [diff] [blame] | 365 | default='docker-prod-virtual.docker.mirantis.net/mirantis/' |
Victor Ryzhenkin | 5175d9e | 2018-06-21 16:24:10 +0400 | [diff] [blame] | 366 | 'kubernetes/k8s-conformance:v1.10.4-4'), |
Vladimir Jigulin | 62bcf46 | 2018-05-28 18:17:01 +0400 | [diff] [blame] | 367 | ct.Cfg('k8s_update_chain', ct.String(), |
Victor Ryzhenkin | 5175d9e | 2018-06-21 16:24:10 +0400 | [diff] [blame] | 368 | default='v1.9.8-4 v1.10.4-4') |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 369 | ] |
| 370 | |
Dmitry Tyzhnenko | 35413c0 | 2018-03-05 14:12:37 +0200 | [diff] [blame] | 371 | day1_cfg_config_opts = [ |
| 372 | ct.Cfg('configure_steps_path', ct.String(), |
| 373 | help="Path to YAML with steps to config cfg01 node", |
| 374 | default=_default_configure_steps), |
| 375 | ct.Cfg('environment_template_dir', ct.String(), |
| 376 | help="Path to directory with Environment template and inventory", |
| 377 | default=_default_environment_template_dir), |
| 378 | ct.Cfg('templates_dir', ct.String(), |
| 379 | help="Path to directory with templates", |
| 380 | default=_default_templates_dir), |
| 381 | ct.Cfg('cluster_maas_config', ct.String(), |
| 382 | help="Path to maas class yaml file for cfg node", |
| 383 | default=_default_cluster_maas_config), |
| 384 | ct.Cfg('maas_machines_macs', ct.JSONDict(), |
| 385 | help="""MAC of machines interfaces for maas config: |
| 386 | 'parameters': { |
| 387 | 'maas' : { |
| 388 | 'region' : { |
| 389 | 'machines': { |
| 390 | 'ctl01': { |
| 391 | 'interface': { |
| 392 | 'mac': 'aa:bb:cc:dd:ee:ff' |
| 393 | } |
| 394 | } |
| 395 | '...': { |
| 396 | 'interface': { |
| 397 | 'mac': 'aa:bb:cc:dd:ee:ff' |
| 398 | } |
| 399 | } |
| 400 | }}}}""", default={}), |
| 401 | ] |
| 402 | |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 403 | _group_opts = [ |
| 404 | ('hardware', hardware_opts), |
| 405 | ('underlay', underlay_opts), |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 406 | ('salt_deploy', salt_deploy_opts), |
| 407 | ('salt', salt_opts), |
Dennis Dmitriev | ea48cf5 | 2018-07-18 18:04:39 +0300 | [diff] [blame] | 408 | ('core_deploy', core_deploy_opts), |
| 409 | ('core', core_opts), |
Dennis Dmitriev | eac3aab | 2017-07-12 16:36:41 +0300 | [diff] [blame] | 410 | ('oss_deploy', oss_deploy_opts), |
| 411 | ('oss', oss_opts), |
sgudz | b67ce73 | 2018-02-13 17:58:31 +0200 | [diff] [blame] | 412 | ('drivetrain_deploy', drivetrain_deploy_opts), |
| 413 | ('drivetrain', drivetrain_opts), |
Dennis Dmitriev | f3f90a5 | 2017-08-10 14:37:05 +0300 | [diff] [blame] | 414 | ('decapod_deploy', decapod_deploy_opts), |
| 415 | ('decapod', decapod_opts), |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 416 | ('openstack_deploy', openstack_deploy_opts), |
| 417 | ('openstack', openstack_opts), |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 418 | ('opencontrail', opencontrail_opts), |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 419 | ('stack_light', sl_opts), |
| 420 | ('sl_deploy', sl_deploy_opts), |
Tatyana Leontovich | a754ce5 | 2017-11-13 16:46:43 +0200 | [diff] [blame] | 421 | ('ceph', ceph_opts), |
| 422 | ('ceph_deploy', ceph_deploy_opts), |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 423 | ('k8s_deploy', k8s_deploy_opts), |
| 424 | ('k8s', k8s_opts), |
Dmitry Tyzhnenko | 35413c0 | 2018-03-05 14:12:37 +0200 | [diff] [blame] | 425 | ('day1_cfg_config', day1_cfg_config_opts), |
| 426 | ('day1_underlay', underlay_opts), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 427 | ] |
| 428 | |
| 429 | |
| 430 | def register_opts(config): |
| 431 | config.register_group(cfg.OptGroup(name='hardware', |
| 432 | title="Hardware settings", help="")) |
| 433 | config.register_opts(group='hardware', opts=hardware_opts) |
| 434 | |
| 435 | config.register_group(cfg.OptGroup(name='underlay', |
| 436 | title="Underlay configuration", help="")) |
| 437 | config.register_opts(group='underlay', opts=underlay_opts) |
| 438 | |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 439 | config.register_group(cfg.OptGroup(name='salt_deploy', |
| 440 | title="salt deploy configuration", help="")) |
| 441 | config.register_opts(group='salt_deploy', opts=salt_deploy_opts) |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 442 | |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 443 | config.register_group(cfg.OptGroup(name='salt', |
| 444 | title="salt config and credentials", help="")) |
| 445 | config.register_opts(group='salt', opts=salt_opts) |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 446 | |
Dennis Dmitriev | ea48cf5 | 2018-07-18 18:04:39 +0300 | [diff] [blame] | 447 | config.register_group(cfg.OptGroup(name='core', |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 448 | title="Common services for Openstack", help="")) |
Dennis Dmitriev | ea48cf5 | 2018-07-18 18:04:39 +0300 | [diff] [blame] | 449 | config.register_opts(group='core', opts=core_opts) |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 450 | |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 451 | config.register_group( |
Dennis Dmitriev | ea48cf5 | 2018-07-18 18:04:39 +0300 | [diff] [blame] | 452 | cfg.OptGroup(name='core_deploy', |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 453 | title="Common services for Openstack deploy config", |
| 454 | help="")) |
Dennis Dmitriev | ea48cf5 | 2018-07-18 18:04:39 +0300 | [diff] [blame] | 455 | config.register_opts(group='core_deploy', |
| 456 | opts=core_deploy_opts) |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 457 | |
Dennis Dmitriev | eac3aab | 2017-07-12 16:36:41 +0300 | [diff] [blame] | 458 | config.register_group(cfg.OptGroup(name='oss', |
| 459 | title="Operational Support System Tools", help="")) |
| 460 | config.register_opts(group='oss', opts=oss_opts) |
| 461 | |
| 462 | config.register_group(cfg.OptGroup(name='oss_deploy', |
| 463 | title="OSS deploy config", help="")) |
| 464 | config.register_opts(group='oss_deploy', |
| 465 | opts=oss_deploy_opts) |
| 466 | |
sgudz | b67ce73 | 2018-02-13 17:58:31 +0200 | [diff] [blame] | 467 | config.register_group(cfg.OptGroup(name='drivetrain', |
| 468 | title="Drivetrain Tools", help="")) |
| 469 | config.register_opts(group='drivetrain', opts=drivetrain_opts) |
| 470 | |
| 471 | config.register_group(cfg.OptGroup(name='drivetrain_deploy', |
| 472 | title="Drivetrain deploy config", help="")) |
| 473 | config.register_opts(group='drivetrain_deploy', |
| 474 | opts=drivetrain_deploy_opts) |
| 475 | |
Dennis Dmitriev | f3f90a5 | 2017-08-10 14:37:05 +0300 | [diff] [blame] | 476 | config.register_group(cfg.OptGroup(name='decapod', |
| 477 | title="Decapod options for Ceph", help="")) |
| 478 | config.register_opts(group='decapod', opts=decapod_opts) |
| 479 | |
| 480 | config.register_group(cfg.OptGroup(name='decapod_deploy', |
| 481 | title="Decapod deploy config", help="")) |
| 482 | config.register_opts(group='decapod_deploy', |
| 483 | opts=decapod_deploy_opts) |
| 484 | |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 485 | config.register_group(cfg.OptGroup(name='openstack', |
| 486 | title="Openstack config and credentials", help="")) |
| 487 | config.register_opts(group='openstack', opts=openstack_opts) |
| 488 | |
| 489 | config.register_group( |
| 490 | cfg.OptGroup(name='openstack_deploy', |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 491 | title="Openstack deploy config and credentials", |
| 492 | help="")) |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 493 | config.register_opts(group='openstack_deploy', opts=openstack_deploy_opts) |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 494 | |
| 495 | config.register_group(cfg.OptGroup(name='opencontrail', |
| 496 | title="Options for Juniper contrail-tests", help="")) |
| 497 | config.register_opts(group='opencontrail', opts=opencontrail_opts) |
Dmitry Tyzhnenko | 8f6a63e | 2017-09-05 15:37:23 +0300 | [diff] [blame] | 498 | config.register_group( |
| 499 | cfg.OptGroup(name='stack_light', |
| 500 | title="StackLight config and credentials", help="")) |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 501 | config.register_opts(group='stack_light', opts=sl_opts) |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 502 | config.register_group( |
| 503 | cfg.OptGroup(name='sl_deploy', |
Dennis Dmitriev | f3f90a5 | 2017-08-10 14:37:05 +0300 | [diff] [blame] | 504 | title="SL deploy config and credentials", |
| 505 | help="")) |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 506 | config.register_opts(group='sl_deploy', opts=sl_deploy_opts) |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 507 | |
| 508 | config.register_group(cfg.OptGroup(name='k8s_deploy', |
| 509 | title="K8s deploy configuration")) |
| 510 | config.register_opts(group='k8s_deploy', opts=k8s_deploy_opts) |
| 511 | |
| 512 | config.register_group(cfg.OptGroup(name='k8s', |
| 513 | title="K8s config and credentials")) |
| 514 | config.register_opts(group='k8s', opts=k8s_opts) |
Tatyana Leontovich | a754ce5 | 2017-11-13 16:46:43 +0200 | [diff] [blame] | 515 | config.register_group(cfg.OptGroup(name='ceph', |
| 516 | title="ceph config", help="")) |
| 517 | config.register_opts(group='ceph', opts=ceph_opts) |
| 518 | |
| 519 | config.register_group( |
| 520 | cfg.OptGroup(name='ceph_deploy', |
| 521 | title="Ceph deploy config ", |
| 522 | help="")) |
| 523 | config.register_opts(group='ceph_deploy', opts=ceph_deploy_opts) |
| 524 | |
Dmitry Tyzhnenko | 35413c0 | 2018-03-05 14:12:37 +0200 | [diff] [blame] | 525 | config.register_group(cfg.OptGroup(name='day1_cfg_config', |
| 526 | title="Day01 config node configuration", help="")) |
| 527 | config.register_opts(group='day1_cfg_config', opts=day1_cfg_config_opts) |
| 528 | |
| 529 | config.register_group(cfg.OptGroup(name='day1_underlay', |
| 530 | title="Day01 underlay configuration", help="")) |
| 531 | config.register_opts(group='day1_underlay', opts=underlay_opts) |
| 532 | |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 533 | return config |
| 534 | |
| 535 | |
| 536 | def load_config(config_files): |
| 537 | config = cfg.CONF |
| 538 | register_opts(config) |
| 539 | config(args=[], default_config_files=config_files) |
| 540 | return config |
| 541 | |
| 542 | |
| 543 | def reload_snapshot_config(config, test_config_path): |
| 544 | """Reset config to the state from test_config file""" |
| 545 | config(args=[], default_config_files=[test_config_path]) |
| 546 | return config |
| 547 | |
| 548 | |
| 549 | def list_opts(): |
| 550 | """Return a list of oslo.config options available in the tcp_tests. |
| 551 | """ |
| 552 | return [(group, copy.deepcopy(opts)) for group, opts in _group_opts] |
| 553 | |
| 554 | |
| 555 | def list_current_opts(config): |
| 556 | """Return a list of oslo.config options available in the tcp_tests. |
| 557 | """ |
| 558 | result_opts = [] |
| 559 | for group, opts in _group_opts: |
| 560 | current_opts = copy.deepcopy(opts) |
| 561 | for opt in current_opts: |
| 562 | if hasattr(config, group): |
| 563 | if hasattr(config[group], opt.name): |
| 564 | opt.default = getattr(config[group], opt.name) |
| 565 | result_opts.append((group, current_opts)) |
| 566 | return result_opts |
| 567 | |
| 568 | |
| 569 | def save_config(config, snapshot_name, env_name=None): |
| 570 | if env_name is None: |
| 571 | env_name = 'config' |
| 572 | test_config_path = os.path.join( |
| 573 | settings.LOGS_DIR, '{0}_{1}.ini'.format(env_name, snapshot_name)) |
| 574 | |
| 575 | with open(test_config_path, 'w') as output_file: |
| 576 | formatter = generator._OptFormatter(output_file=output_file) |
| 577 | for group, opts in list_current_opts(config): |
| 578 | formatter.format_group(group) |
| 579 | for opt in opts: |
| 580 | formatter.format(opt, group, minimal=True) |
| 581 | formatter.write('\n') |
| 582 | formatter.write('\n') |