blob: 037dbd84136e6ab69bcb7ead3e13845f82dc338d [file] [log] [blame]
Dennis Dmitriev6f59add2016-10-18 13:45:27 +03001# 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.
14import copy
15import os
16import pkg_resources
17
18from oslo_config import cfg
19from oslo_config import generator
20
21from tcp_tests.helpers import ext
22from tcp_tests.helpers import oslo_cfg_types as ct
23from tcp_tests import settings
24
Dennis Dmitriev9b02c8b2017-11-13 15:31:35 +020025print("\n" + "-" * 10 + " Initialize oslo.config variables with defaults"
26 " from environment" + "-" * 10)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +030027
28_default_conf = pkg_resources.resource_filename(
Dennis Dmitrievab83ea42017-05-12 16:52:45 +030029 __name__, 'templates/{0}/underlay.yaml'.format(settings.LAB_CONFIG_NAME))
Dennis Dmitriev6860ba62016-11-01 21:43:46 +020030
31_default_salt_steps = pkg_resources.resource_filename(
Dennis Dmitrievab83ea42017-05-12 16:52:45 +030032 __name__, 'templates/{0}/salt.yaml'.format(settings.LAB_CONFIG_NAME))
Dennis Dmitriev9dada8a2017-08-30 17:38:55 +030033_default_environment_template_dir = pkg_resources.resource_filename(
34 __name__, 'environment/')
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +030035_default_templates_dir = pkg_resources.resource_filename(
36 __name__, 'templates/')
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030037_default_core_steps = pkg_resources.resource_filename(
Dennis Dmitriev6860ba62016-11-01 21:43:46 +020038 __name__,
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030039 'templates/{0}/core.yaml'.format(
Dennis Dmitriev2a13a132016-11-04 00:56:23 +020040 settings.LAB_CONFIG_NAME))
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +030041_default_oss_steps = pkg_resources.resource_filename(
42 __name__,
43 'templates/{0}/oss.yaml'.format(
44 settings.LAB_CONFIG_NAME))
sgudzb67ce732018-02-13 17:58:31 +020045_default_drivetrain_steps = pkg_resources.resource_filename(
46 __name__,
47 'templates/{0}/drivetrain.yaml'.format(
48 settings.LAB_CONFIG_NAME))
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +030049_default_decapod_steps = pkg_resources.resource_filename(
50 __name__,
51 'templates/{0}/decapod.yaml'.format(
52 settings.LAB_CONFIG_NAME))
Dennis Dmitriev6860ba62016-11-01 21:43:46 +020053_default_openstack_steps = pkg_resources.resource_filename(
Dennis Dmitrievab83ea42017-05-12 16:52:45 +030054 __name__, 'templates/{0}/openstack.yaml'.format(
Dennis Dmitriev2a13a132016-11-04 00:56:23 +020055 settings.LAB_CONFIG_NAME))
Dina Belovae6fdffb2017-09-19 13:58:34 -070056_default_opencontrail_prepare_tests_steps_path = \
57 pkg_resources.resource_filename(
58 __name__, 'templates/{0}/opencontrail.yaml'.format(
59 settings.LAB_CONFIG_NAME))
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030060_default_sl_prepare_tests_steps_path = pkg_resources.resource_filename(
61 __name__, 'templates/{0}/sl.yaml'.format(
62 settings.LAB_CONFIG_NAME))
Tatyana Leontovich460f7df2017-11-13 15:45:06 +020063_default_ceph_prepare_tests_steps_path = pkg_resources.resource_filename(
64 __name__, 'templates/{0}/ceph.yaml'.format(
65 settings.LAB_CONFIG_NAME))
Artem Panchenko0594cd72017-06-12 13:25:26 +030066_default_k8s_steps = pkg_resources.resource_filename(
67 __name__, 'templates/{0}/k8s.yaml'.format(
68 settings.LAB_CONFIG_NAME))
Vladimir Jigulin62bcf462018-05-28 18:17:01 +040069_default_k8s_update_steps = pkg_resources.resource_filename(
70 __name__, 'templates/{0}/k8s-update.yaml'.format(
71 settings.LAB_CONFIG_NAME))
Dmitry Tyzhnenkob8641832017-11-07 17:02:47 +020072_default_net_mgm = os.environ.get("NET_MGMT", "admin-pool01")
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +020073_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 Dmitriev6f59add2016-10-18 13:45:27 +030080
81hardware_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
92underlay_opts = [
93 ct.Cfg('ssh', ct.JSONList(),
94 help="""SSH Settings for Underlay: [{
95 'node_name': node1,
Dennis Dmitriev23e5d192016-10-31 11:27:10 +020096 'roles': ['salt-master', 'salt-minion', ],
Dennis Dmitriev6f59add2016-10-18 13:45:27 +030097 '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 Dmitriev53d3b772016-10-18 14:31:58 +0300106 default=[ext.UNDERLAY_NODE_ROLES.salt_master,
vrovachev99228d32017-06-08 19:46:10 +0400107 ext.UNDERLAY_NODE_ROLES.salt_minion,
Victor Ryzhenkin66d39372017-09-28 19:25:48 +0400108 ext.UNDERLAY_NODE_ROLES.k8s_controller]),
Dennis Dmitriev7b9538f2017-05-15 17:01:34 +0300109 ct.Cfg('bootstrap_timeout', ct.Integer(),
110 help="Timeout of waiting SSH for nodes with specified roles",
Dennis Dmitriev4558ee92018-01-31 08:14:08 -0400111 default=600),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300112 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 Dmitriev99b26fe2017-04-26 12:34:44 +0300120 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 Panchenkodb0a97f2017-06-27 19:09:13 +0300126 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 Tyzhnenkob8641832017-11-07 17:02:47 +0200131 ct.Cfg('net_mgmt', ct.String(), default=_default_net_mgm)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300132]
133
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200134
135salt_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 Dmitriev9dada8a2017-08-30 17:38:55 +0300139 ct.Cfg('environment_template_dir', ct.String(),
140 help="Path to directory with Environment template and inventory",
141 default=_default_environment_template_dir),
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +0300142 ct.Cfg('templates_dir', ct.String(),
143 help="Path to directory with templates",
144 default=_default_templates_dir),
Dennis Dmitriev5bcbdc52018-03-23 18:05:10 +0200145 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 Dmitriev6f59add2016-10-18 13:45:27 +0300150]
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200151salt_opts = [
152 ct.Cfg('salt_master_host', ct.IPAddress(),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300153 help="", default='0.0.0.0'),
Dennis Dmitriev2d60c8e2017-05-12 18:34:01 +0300154 ct.Cfg('salt_master_port', ct.String(),
155 help="", default='6969'),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300156]
157
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300158core_deploy_opts = [
159 ct.Cfg('core_steps_path', ct.String(),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200160 help="Path to YAML with steps to deploy common services",
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300161 default=_default_core_steps),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300162]
163
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300164core_opts = [
165 ct.Cfg('core_installed', ct.Boolean(),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200166 help="", default=False),
167]
168
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300169oss_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
175oss_opts = [
176 ct.Cfg('oss_installed', ct.Boolean(),
177 help="", default=False),
178]
179
sgudzb67ce732018-02-13 17:58:31 +0200180drivetrain_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
186drivetrain_opts = [
187 ct.Cfg('drivetrain_installed', ct.Boolean(),
188 help="", default=False),
189]
190
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300191decapod_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
197decapod_opts = [
198 ct.Cfg('decapod_installed', ct.Boolean(),
199 help="", default=False),
200]
201
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200202openstack_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 Leontovichc72604d2018-01-04 17:58:00 +0200206 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 Dmitriev6860ba62016-11-01 21:43:46 +0200214]
215openstack_opts = [
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200216 ct.Cfg('openstack_installed', ct.Boolean(),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200217 help="", default=False),
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200218 ct.Cfg('openstack_keystone_endpoint', ct.String(),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300219 help="", default=''),
Tatyana Leontovichc08a54b2018-04-19 02:21:25 +0300220 ct.Cfg('horizon_check', ct.Boolean(),
Tatyana Leontovich69700712018-04-23 12:26:57 +0300221 help="", default=False),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300222]
223
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200224opencontrail_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 Dmitriev6f59add2016-10-18 13:45:27 +0300233
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300234sl_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 Leontovichf00b2342017-07-04 18:26:25 +0300238 ct.Cfg('docker_image_alertmanager', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200239 default='{0}/openstack-docker/alertmanager:{1}'.format(
240 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Dmitry Kalashnik3eee60b2018-05-29 17:19:31 +0400241 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 Leontovichf00b2342017-07-04 18:26:25 +0300244 ct.Cfg('docker_image_pushgateway', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200245 default='{0}/openstack-docker/pushgateway:{1}'.format(
246 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300247 ct.Cfg('docker_image_prometheus', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200248 default='{0}/openstack-docker/prometheus:{1}'.format(
249 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300250 ct.Cfg('docker_image_remote_agent', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200251 default='{0}/openstack-docker/telegraf:{1}'.format(
252 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300253 ct.Cfg('docker_image_remote_storage_adapter', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200254 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 Dmitriev86f63e82017-11-09 00:07:45 +0200262 # SalesForce connection options for pushkin
Dennis Dmitrievce5ed8b2017-11-09 00:44:19 +0200263 ct.Cfg('sfdc_sandbox_enabled', ct.String(), default='False'),
Dennis Dmitriev86f63e82017-11-09 00:07:45 +0200264 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 Leontovichc8b8ca22017-05-19 13:37:05 +0300270]
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300271
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300272sl_opts = [
Dennis Dmitrievfde667f2018-07-23 16:26:50 +0300273 ct.Cfg('stacklight_installed', ct.Boolean(),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300274 help="", default=False),
sgudzbf4de572017-11-23 14:37:01 +0200275 ct.Cfg('sl_version', ct.String(),
276 help="StackLight version. Could be 1 or 2", default=''),
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300277 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 Leontovichc8b8ca22017-05-19 13:37:05 +0300283]
284
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200285ceph_deploy_opts = [
286 ct.Cfg('ceph_steps_path', ct.String(),
287 help="Path to YAML with steps to deploy sl",
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200288 default=_default_ceph_prepare_tests_steps_path),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200289]
290
291ceph_opts = [
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200292 ct.Cfg('ceph_installed', ct.Boolean(),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200293 help="", default=False),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200294]
295
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300296k8s_deploy_opts = [
Artem Panchenko0594cd72017-06-12 13:25:26 +0300297 ct.Cfg('k8s_steps_path', ct.String(),
298 help="Path to YAML with steps to deploy Kubernetes",
299 default=_default_k8s_steps),
Vladimir Jigulin62bcf462018-05-28 18:17:01 +0400300 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 Panchenko0594cd72017-06-12 13:25:26 +0300303 ct.Cfg('kubernetes_admin_user', ct.String(), default='admin'),
304 ct.Cfg('kubernetes_admin_password', ct.String(),
305 default='sbPfel23ZigJF3Bm'),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300306 ct.Cfg('kubernetes_docker_package', ct.String(), default=''),
307 ct.Cfg('kubernetes_hyperkube_image', ct.String(),
Victor Ryzhenkin92e451e2018-06-19 20:01:16 +0400308 default='{}/mirantis/kubernetes/hyperkube-amd64:v1.10.4-4'.format(
Victor Ryzhenkin2687fa12018-05-24 16:28:17 +0400309 settings.DOCKER_REGISTRY)),
310 ct.Cfg('kubernetes_pause_image', ct.String(),
Victor Ryzhenkin92e451e2018-06-19 20:01:16 +0400311 default='{}/mirantis/kubernetes/pause-amd64:v1.10.4-4'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300312 settings.DOCKER_REGISTRY)),
313 ct.Cfg('kubernetes_calico_image', ct.String(),
Aleksei Kasatkin1d252f02018-08-29 13:15:58 +0200314 default='{}/mirantis/projectcalico/calico/node:v3.1.3'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300315 settings.DOCKER_REGISTRY)),
Victor Ryzhenkin53f1b492018-05-09 17:30:17 +0400316 ct.Cfg('kubernetes_calico_calicoctl_image', ct.String(),
Aleksei Kasatkin1d252f02018-08-29 13:15:58 +0200317 default='{}/mirantis/projectcalico/calico/ctl:v3.1.3'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300318 settings.DOCKER_REGISTRY)),
319 ct.Cfg('kubernetes_calico_cni_image', ct.String(),
Aleksei Kasatkin1d252f02018-08-29 13:15:58 +0200320 default='{}/mirantis/projectcalico/calico/cni:v3.1.3'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300321 settings.DOCKER_REGISTRY)),
Aleksei Kasatkin1d252f02018-08-29 13:15:58 +0200322 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 Panchenko0594cd72017-06-12 13:25:26 +0300325 ct.Cfg('kubernetes_netchecker_enabled', ct.Boolean(),
326 help="", default=True),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300327 ct.Cfg('kubernetes_netchecker_agent_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200328 default='mirantis/k8s-netchecker-agent:v1.2.2'),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300329 ct.Cfg('kubernetes_netchecker_server_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200330 default='mirantis/k8s-netchecker-server:v1.2.2'),
Artem Panchenko501e67e2017-06-14 14:59:18 +0300331 ct.Cfg('kubernetes_calico_policy_enabled', ct.Boolean(),
332 help="", default=False),
Artem Panchenko501e67e2017-06-14 14:59:18 +0300333 ct.Cfg('kubernetes_helm_enabled', ct.Boolean(),
Tatyana Leontovich038dc7d2017-09-22 16:25:59 +0300334 help="", default=False),
Victor Ryzhenkin0bf0bb02017-07-06 18:57:05 +0400335 ct.Cfg('kubernetes_virtlet_enabled', ct.Boolean(),
Tatyana Leontovich038dc7d2017-09-22 16:25:59 +0300336 help="", default=False),
Victor Ryzhenkin0bf0bb02017-07-06 18:57:05 +0400337 ct.Cfg('kubernetes_virtlet_image', ct.String(),
Victor Ryzhenkin92e451e2018-06-19 20:01:16 +0400338 help="", default='mirantis/virtlet:v1.1.0'),
Victor Ryzhenkin5902ae62018-09-11 20:34:54 +0400339 ct.Cfg('kubernetes_dns', ct.Boolean(),
340 help="", default=True),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400341 ct.Cfg('kubernetes_externaldns_enabled', ct.Boolean(),
342 help="", default=False),
343 ct.Cfg('kubernetes_externaldns_image', ct.String(),
344 help="", default='mirantis/external-dns:latest'),
345 ct.Cfg('kubernetes_externaldns_provider', ct.String(),
346 help="", default='coredns'),
347 ct.Cfg('kubernetes_coredns_enabled', ct.Boolean(),
Victor Ryzhenkin2a5806e2017-12-18 20:23:53 +0400348 help="", default=False),
Vladimir Jigulina6b018b2018-07-18 15:19:01 +0400349 ct.Cfg('kubernetes_metallb_enabled', ct.Boolean(),
350 help="", default=False),
Victor Ryzhenkin2a5806e2017-12-18 20:23:53 +0400351 ct.Cfg('kubelet_fail_on_swap', ct.Boolean(),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400352 help="", default=False)
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300353]
354
355k8s_opts = [
Artem Panchenko0594cd72017-06-12 13:25:26 +0300356 ct.Cfg('k8s_installed', ct.Boolean(),
357 help="", default=False),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300358 ct.Cfg('kube_host', ct.IPAddress(),
359 help="", default='0.0.0.0'),
360 ct.Cfg('kube_apiserver_port', ct.Integer(),
361 help="", default=443),
vrovacheva9d08332017-06-22 20:01:59 +0400362 ct.Cfg("k8s_conformance_run", ct.Boolean(),
363 default=False),
Victor Ryzhenkin8ff3c3f2018-01-17 19:37:05 +0400364 ct.Cfg("run_extended_virtlet_conformance", ct.Boolean(),
365 default=False),
vrovacheva9d08332017-06-22 20:01:59 +0400366 ct.Cfg('k8s_conformance_image', ct.String(),
Dennis Dmitriev75776c52017-12-26 18:22:53 +0200367 default='docker-prod-virtual.docker.mirantis.net/mirantis/'
Victor Ryzhenkin5175d9e2018-06-21 16:24:10 +0400368 'kubernetes/k8s-conformance:v1.10.4-4'),
Vladimir Jigulin62bcf462018-05-28 18:17:01 +0400369 ct.Cfg('k8s_update_chain', ct.String(),
Victor Ryzhenkin5175d9e2018-06-21 16:24:10 +0400370 default='v1.9.8-4 v1.10.4-4')
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300371]
372
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +0200373day1_cfg_config_opts = [
374 ct.Cfg('configure_steps_path', ct.String(),
375 help="Path to YAML with steps to config cfg01 node",
376 default=_default_configure_steps),
377 ct.Cfg('environment_template_dir', ct.String(),
378 help="Path to directory with Environment template and inventory",
379 default=_default_environment_template_dir),
380 ct.Cfg('templates_dir', ct.String(),
381 help="Path to directory with templates",
382 default=_default_templates_dir),
383 ct.Cfg('cluster_maas_config', ct.String(),
384 help="Path to maas class yaml file for cfg node",
385 default=_default_cluster_maas_config),
386 ct.Cfg('maas_machines_macs', ct.JSONDict(),
387 help="""MAC of machines interfaces for maas config:
388 'parameters': {
389 'maas' : {
390 'region' : {
391 'machines': {
392 'ctl01': {
393 'interface': {
394 'mac': 'aa:bb:cc:dd:ee:ff'
395 }
396 }
397 '...': {
398 'interface': {
399 'mac': 'aa:bb:cc:dd:ee:ff'
400 }
401 }
402 }}}}""", default={}),
403]
404
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300405_group_opts = [
406 ('hardware', hardware_opts),
407 ('underlay', underlay_opts),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200408 ('salt_deploy', salt_deploy_opts),
409 ('salt', salt_opts),
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300410 ('core_deploy', core_deploy_opts),
411 ('core', core_opts),
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300412 ('oss_deploy', oss_deploy_opts),
413 ('oss', oss_opts),
sgudzb67ce732018-02-13 17:58:31 +0200414 ('drivetrain_deploy', drivetrain_deploy_opts),
415 ('drivetrain', drivetrain_opts),
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300416 ('decapod_deploy', decapod_deploy_opts),
417 ('decapod', decapod_opts),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200418 ('openstack_deploy', openstack_deploy_opts),
419 ('openstack', openstack_opts),
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200420 ('opencontrail', opencontrail_opts),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300421 ('stack_light', sl_opts),
422 ('sl_deploy', sl_deploy_opts),
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200423 ('ceph', ceph_opts),
424 ('ceph_deploy', ceph_deploy_opts),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300425 ('k8s_deploy', k8s_deploy_opts),
426 ('k8s', k8s_opts),
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +0200427 ('day1_cfg_config', day1_cfg_config_opts),
428 ('day1_underlay', underlay_opts),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300429]
430
431
432def register_opts(config):
433 config.register_group(cfg.OptGroup(name='hardware',
434 title="Hardware settings", help=""))
435 config.register_opts(group='hardware', opts=hardware_opts)
436
437 config.register_group(cfg.OptGroup(name='underlay',
438 title="Underlay configuration", help=""))
439 config.register_opts(group='underlay', opts=underlay_opts)
440
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200441 config.register_group(cfg.OptGroup(name='salt_deploy',
442 title="salt deploy configuration", help=""))
443 config.register_opts(group='salt_deploy', opts=salt_deploy_opts)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300444
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200445 config.register_group(cfg.OptGroup(name='salt',
446 title="salt config and credentials", help=""))
447 config.register_opts(group='salt', opts=salt_opts)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300448
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300449 config.register_group(cfg.OptGroup(name='core',
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200450 title="Common services for Openstack", help=""))
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300451 config.register_opts(group='core', opts=core_opts)
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200452
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300453 config.register_group(
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300454 cfg.OptGroup(name='core_deploy',
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200455 title="Common services for Openstack deploy config",
456 help=""))
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300457 config.register_opts(group='core_deploy',
458 opts=core_deploy_opts)
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200459
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300460 config.register_group(cfg.OptGroup(name='oss',
461 title="Operational Support System Tools", help=""))
462 config.register_opts(group='oss', opts=oss_opts)
463
464 config.register_group(cfg.OptGroup(name='oss_deploy',
465 title="OSS deploy config", help=""))
466 config.register_opts(group='oss_deploy',
467 opts=oss_deploy_opts)
468
sgudzb67ce732018-02-13 17:58:31 +0200469 config.register_group(cfg.OptGroup(name='drivetrain',
470 title="Drivetrain Tools", help=""))
471 config.register_opts(group='drivetrain', opts=drivetrain_opts)
472
473 config.register_group(cfg.OptGroup(name='drivetrain_deploy',
474 title="Drivetrain deploy config", help=""))
475 config.register_opts(group='drivetrain_deploy',
476 opts=drivetrain_deploy_opts)
477
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300478 config.register_group(cfg.OptGroup(name='decapod',
479 title="Decapod options for Ceph", help=""))
480 config.register_opts(group='decapod', opts=decapod_opts)
481
482 config.register_group(cfg.OptGroup(name='decapod_deploy',
483 title="Decapod deploy config", help=""))
484 config.register_opts(group='decapod_deploy',
485 opts=decapod_deploy_opts)
486
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200487 config.register_group(cfg.OptGroup(name='openstack',
488 title="Openstack config and credentials", help=""))
489 config.register_opts(group='openstack', opts=openstack_opts)
490
491 config.register_group(
492 cfg.OptGroup(name='openstack_deploy',
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300493 title="Openstack deploy config and credentials",
494 help=""))
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200495 config.register_opts(group='openstack_deploy', opts=openstack_deploy_opts)
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200496
497 config.register_group(cfg.OptGroup(name='opencontrail',
498 title="Options for Juniper contrail-tests", help=""))
499 config.register_opts(group='opencontrail', opts=opencontrail_opts)
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +0300500 config.register_group(
501 cfg.OptGroup(name='stack_light',
502 title="StackLight config and credentials", help=""))
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300503 config.register_opts(group='stack_light', opts=sl_opts)
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300504 config.register_group(
505 cfg.OptGroup(name='sl_deploy',
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300506 title="SL deploy config and credentials",
507 help=""))
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300508 config.register_opts(group='sl_deploy', opts=sl_deploy_opts)
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300509
510 config.register_group(cfg.OptGroup(name='k8s_deploy',
511 title="K8s deploy configuration"))
512 config.register_opts(group='k8s_deploy', opts=k8s_deploy_opts)
513
514 config.register_group(cfg.OptGroup(name='k8s',
515 title="K8s config and credentials"))
516 config.register_opts(group='k8s', opts=k8s_opts)
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200517 config.register_group(cfg.OptGroup(name='ceph',
518 title="ceph config", help=""))
519 config.register_opts(group='ceph', opts=ceph_opts)
520
521 config.register_group(
522 cfg.OptGroup(name='ceph_deploy',
523 title="Ceph deploy config ",
524 help=""))
525 config.register_opts(group='ceph_deploy', opts=ceph_deploy_opts)
526
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +0200527 config.register_group(cfg.OptGroup(name='day1_cfg_config',
528 title="Day01 config node configuration", help=""))
529 config.register_opts(group='day1_cfg_config', opts=day1_cfg_config_opts)
530
531 config.register_group(cfg.OptGroup(name='day1_underlay',
532 title="Day01 underlay configuration", help=""))
533 config.register_opts(group='day1_underlay', opts=underlay_opts)
534
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300535 return config
536
537
538def load_config(config_files):
539 config = cfg.CONF
540 register_opts(config)
541 config(args=[], default_config_files=config_files)
542 return config
543
544
545def reload_snapshot_config(config, test_config_path):
546 """Reset config to the state from test_config file"""
547 config(args=[], default_config_files=[test_config_path])
548 return config
549
550
551def list_opts():
552 """Return a list of oslo.config options available in the tcp_tests.
553 """
554 return [(group, copy.deepcopy(opts)) for group, opts in _group_opts]
555
556
557def list_current_opts(config):
558 """Return a list of oslo.config options available in the tcp_tests.
559 """
560 result_opts = []
561 for group, opts in _group_opts:
562 current_opts = copy.deepcopy(opts)
563 for opt in current_opts:
564 if hasattr(config, group):
565 if hasattr(config[group], opt.name):
566 opt.default = getattr(config[group], opt.name)
567 result_opts.append((group, current_opts))
568 return result_opts
569
570
571def save_config(config, snapshot_name, env_name=None):
572 if env_name is None:
573 env_name = 'config'
574 test_config_path = os.path.join(
575 settings.LOGS_DIR, '{0}_{1}.ini'.format(env_name, snapshot_name))
576
577 with open(test_config_path, 'w') as output_file:
578 formatter = generator._OptFormatter(output_file=output_file)
579 for group, opts in list_current_opts(config):
580 formatter.format_group(group)
581 for opt in opts:
582 formatter.format(opt, group, minimal=True)
583 formatter.write('\n')
584 formatter.write('\n')