blob: fa618843d059c2787073158b38170481b81dd3e9 [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
25
26_default_conf = pkg_resources.resource_filename(
Dennis Dmitrievab83ea42017-05-12 16:52:45 +030027 __name__, 'templates/{0}/underlay.yaml'.format(settings.LAB_CONFIG_NAME))
Dennis Dmitrievf5f2e602017-11-03 15:36:19 +020028_default_heat_conf = pkg_resources.resource_filename(
29 __name__, 'templates/{0}/underlay.hot'.format(settings.LAB_CONFIG_NAME))
30_default_heat_env = pkg_resources.resource_filename(
Dennis Dmitrievc902ad82019-04-12 13:41:30 +030031 __name__, 'templates/_heat_environments/{0}'.format(
32 settings.LAB_PARAM_DEFAULTS))
Dennis Dmitriev6860ba62016-11-01 21:43:46 +020033
34_default_salt_steps = pkg_resources.resource_filename(
Dennis Dmitrievab83ea42017-05-12 16:52:45 +030035 __name__, 'templates/{0}/salt.yaml'.format(settings.LAB_CONFIG_NAME))
Dennis Dmitriev9dada8a2017-08-30 17:38:55 +030036_default_environment_template_dir = pkg_resources.resource_filename(
37 __name__, 'environment/')
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +030038_default_templates_dir = pkg_resources.resource_filename(
39 __name__, 'templates/')
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030040_default_core_steps = pkg_resources.resource_filename(
Dennis Dmitriev6860ba62016-11-01 21:43:46 +020041 __name__,
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030042 'templates/{0}/core.yaml'.format(
Dennis Dmitriev2a13a132016-11-04 00:56:23 +020043 settings.LAB_CONFIG_NAME))
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +030044_default_oss_steps = pkg_resources.resource_filename(
45 __name__,
46 'templates/{0}/oss.yaml'.format(
47 settings.LAB_CONFIG_NAME))
sgudzb67ce732018-02-13 17:58:31 +020048_default_drivetrain_steps = pkg_resources.resource_filename(
49 __name__,
50 'templates/{0}/drivetrain.yaml'.format(
51 settings.LAB_CONFIG_NAME))
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +030052_default_decapod_steps = pkg_resources.resource_filename(
53 __name__,
54 'templates/{0}/decapod.yaml'.format(
55 settings.LAB_CONFIG_NAME))
Dennis Dmitriev6860ba62016-11-01 21:43:46 +020056_default_openstack_steps = pkg_resources.resource_filename(
Dennis Dmitrievab83ea42017-05-12 16:52:45 +030057 __name__, 'templates/{0}/openstack.yaml'.format(
Dennis Dmitriev2a13a132016-11-04 00:56:23 +020058 settings.LAB_CONFIG_NAME))
Tatyana Leontovich8dbc7882018-08-29 13:11:16 +030059_default_openstack_resources_steps = pkg_resources.resource_filename(
60 __name__, 'templates/{0}/post_openstack.yaml'.format(
61 settings.LAB_CONFIG_NAME))
Dina Belovae6fdffb2017-09-19 13:58:34 -070062_default_opencontrail_prepare_tests_steps_path = \
63 pkg_resources.resource_filename(
64 __name__, 'templates/{0}/opencontrail.yaml'.format(
65 settings.LAB_CONFIG_NAME))
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030066_default_sl_prepare_tests_steps_path = pkg_resources.resource_filename(
67 __name__, 'templates/{0}/sl.yaml'.format(
68 settings.LAB_CONFIG_NAME))
Tatyana Leontovich460f7df2017-11-13 15:45:06 +020069_default_ceph_prepare_tests_steps_path = pkg_resources.resource_filename(
70 __name__, 'templates/{0}/ceph.yaml'.format(
71 settings.LAB_CONFIG_NAME))
Artem Panchenko0594cd72017-06-12 13:25:26 +030072_default_k8s_steps = pkg_resources.resource_filename(
73 __name__, 'templates/{0}/k8s.yaml'.format(
74 settings.LAB_CONFIG_NAME))
Vladimir Jigulin62bcf462018-05-28 18:17:01 +040075_default_k8s_update_steps = pkg_resources.resource_filename(
76 __name__, 'templates/{0}/k8s-update.yaml'.format(
77 settings.LAB_CONFIG_NAME))
Dmitry Tyzhnenkob8641832017-11-07 17:02:47 +020078_default_net_mgm = os.environ.get("NET_MGMT", "admin-pool01")
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +020079_default_configure_steps = pkg_resources.resource_filename(
80 __name__, 'templates/{0}/cfg01_configure.yaml'.format(
81 settings.LAB_CONFIG_NAME))
82# _default_cluster_maas_config = pkg_resources.resource_filename(
83# __name__, 'templates/{0}/cluster_infra_maas.yml'.format(
84# settings.LAB_CONFIG_NAME))
85_default_cluster_maas_config = 'cluster_infra_maas.yml'
Dennis Dmitriev6f59add2016-10-18 13:45:27 +030086
87hardware_opts = [
Dennis Dmitriev552454c2019-03-21 23:15:51 +020088 ct.Cfg('env_manager', ct.String(),
89 help="Hardware environment manager name", default="devops"),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +030090 ct.Cfg('conf_path', ct.String(),
91 help="Hardware config file", default=_default_conf),
92 ct.Cfg('current_snapshot', ct.String(),
93 help="Latest environment status name",
94 default=ext.SNAPSHOT.hardware),
Dennis Dmitrievf5f2e602017-11-03 15:36:19 +020095
96 ct.Cfg('heat_stack_name', ct.String(),
97 help="Heat stack name", default=''),
98 ct.Cfg('heat_conf_path', ct.String(),
99 help="Heat template file", default=_default_heat_conf),
100 ct.Cfg('heat_env_path', ct.String(),
101 help="Heat environment parameters file", default=_default_heat_env),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300102]
103
104
105underlay_opts = [
106 ct.Cfg('ssh', ct.JSONList(),
107 help="""SSH Settings for Underlay: [{
108 'node_name': node1,
Dennis Dmitriev83cc1d52018-11-09 15:35:30 +0200109 'minion_id': node1.local,
Dennis Dmitriev23e5d192016-10-31 11:27:10 +0200110 'roles': ['salt-master', 'salt-minion', ],
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300111 'host': hostname,
112 'login': login,
113 'password': password,
114 'address_pool': (optional),
115 'port': (optional),
116 'keys': [(optional)],
117 }, ...]""", default=[]),
118 ct.Cfg('roles', ct.JSONList(),
119 help="Node roles managed by underlay in the environment",
Dennis Dmitriev53d3b772016-10-18 14:31:58 +0300120 default=[ext.UNDERLAY_NODE_ROLES.salt_master,
vrovachev99228d32017-06-08 19:46:10 +0400121 ext.UNDERLAY_NODE_ROLES.salt_minion,
Victor Ryzhenkin66d39372017-09-28 19:25:48 +0400122 ext.UNDERLAY_NODE_ROLES.k8s_controller]),
Dennis Dmitriev7b9538f2017-05-15 17:01:34 +0300123 ct.Cfg('bootstrap_timeout', ct.Integer(),
124 help="Timeout of waiting SSH for nodes with specified roles",
Dennis Dmitriev4558ee92018-01-31 08:14:08 -0400125 default=600),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300126 ct.Cfg('nameservers', ct.JSONList(),
127 help="IP addresses of DNS servers",
128 default=[]),
129 ct.Cfg('upstream_dns_servers', ct.JSONList(),
130 help="IP addresses of upstream DNS servers (dnsmasq)",
131 default=[]),
Dennis Dmitriev99b26fe2017-04-26 12:34:44 +0300132 ct.Cfg('address_pools', ct.JSONDict(),
133 help="""Address pools (dynamically) allocated for the environment.
134 May be used to determine CIDR for a specific network from
135 tests or during the deployment process.
136 {'pool_name1': '<cidr>', 'pool_name2': '<cidr>', ...}""",
137 default={}),
Dennis Dmitrievb6bcc5c2018-09-26 11:07:53 +0000138 ct.Cfg('dhcp_ranges', ct.JSONDict(),
139 help="""DHCP ranges allocated for the address pools.
140 This is extended object comparing to 'address_pools'.
141 May be used to determine DHCP range start/end/gateway for a
142 specific network from tests or during the deployment
143 process.
144 {'pool_name1': {'cidr': 'n.n.n.n/m',
145 'start': 'x.x.x.x',
146 'end': 'y.y.y.y',
147 'gateway': 'z.z.z.z'},
148 'pool_name2': {'cidr': 'n.n.n.n/m',
149 'start': x.x.x.x,
150 'end': 'y.y.y.y',
151 'gateway': 'z.z.z.z'},
152 ...}""",
153 default={}),
Artem Panchenkodb0a97f2017-06-27 19:09:13 +0300154 ct.Cfg('ssh_keys', ct.JSONList(), default=[],
155 help="SSH key pair(s) for root. If the option is left empty, "
156 "then a key pair will be generated automatically"),
157 ct.Cfg('ssh_key_file', ct.String(), default=os.path.abspath('./id_rsa'),
158 help='Path (local) to file with private key authorized on nodes'),
Dmitry Tyzhnenkob8641832017-11-07 17:02:47 +0200159 ct.Cfg('net_mgmt', ct.String(), default=_default_net_mgm)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300160]
161
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200162
163salt_deploy_opts = [
164 ct.Cfg('salt_steps_path', ct.String(),
165 help="Path to YAML with steps to deploy salt",
166 default=_default_salt_steps),
Dennis Dmitriev9dada8a2017-08-30 17:38:55 +0300167 ct.Cfg('environment_template_dir', ct.String(),
168 help="Path to directory with Environment template and inventory",
169 default=_default_environment_template_dir),
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +0300170 ct.Cfg('templates_dir', ct.String(),
171 help="Path to directory with templates",
172 default=_default_templates_dir),
Dennis Dmitriev5bcbdc52018-03-23 18:05:10 +0200173 ct.Cfg('salt_roles', ct.JSONList(),
174 help="Node roles to install salt-minions and manage by salt",
175 default=[ext.UNDERLAY_NODE_ROLES.salt_master,
176 ext.UNDERLAY_NODE_ROLES.salt_minion,
177 ext.UNDERLAY_NODE_ROLES.k8s_controller]),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300178]
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200179salt_opts = [
180 ct.Cfg('salt_master_host', ct.IPAddress(),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300181 help="", default='0.0.0.0'),
Dennis Dmitriev2d60c8e2017-05-12 18:34:01 +0300182 ct.Cfg('salt_master_port', ct.String(),
183 help="", default='6969'),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300184]
185
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300186core_deploy_opts = [
187 ct.Cfg('core_steps_path', ct.String(),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200188 help="Path to YAML with steps to deploy common services",
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300189 default=_default_core_steps),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300190]
191
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300192core_opts = [
193 ct.Cfg('core_installed', ct.Boolean(),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200194 help="", default=False),
195]
196
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300197oss_deploy_opts = [
198 ct.Cfg('oss_steps_path', ct.String(),
199 help="Path to YAML with steps to deploy OSS Tools",
200 default=_default_oss_steps),
201]
202
203oss_opts = [
204 ct.Cfg('oss_installed', ct.Boolean(),
205 help="", default=False),
206]
207
sgudzb67ce732018-02-13 17:58:31 +0200208drivetrain_deploy_opts = [
209 ct.Cfg('drivetrain_steps_path', ct.String(),
210 help="Path to YAML with steps to deploy Drivetrain",
211 default=_default_drivetrain_steps),
212]
213
214drivetrain_opts = [
215 ct.Cfg('drivetrain_installed', ct.Boolean(),
216 help="", default=False),
217]
218
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300219decapod_deploy_opts = [
220 ct.Cfg('decapod_steps_path', ct.String(),
221 help="Path to YAML with steps to deploy Ceph with Decapod",
222 default=_default_decapod_steps),
223]
224
225decapod_opts = [
226 ct.Cfg('decapod_installed', ct.Boolean(),
227 help="", default=False),
228]
229
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200230openstack_deploy_opts = [
231 ct.Cfg('openstack_steps_path', ct.String(),
232 help="Path to YAML with steps to deploy openstack",
233 default=_default_openstack_steps),
Tatyana Leontovich8dbc7882018-08-29 13:11:16 +0300234 ct.Cfg('openstack_resources_steps_path', ct.String(),
235 help="Path to YAML with steps to deploy openstack",
236 default=_default_openstack_resources_steps),
Tatyana Leontovichc72604d2018-01-04 17:58:00 +0200237 ct.Cfg('horizon_host', ct.IPAddress(),
238 help="", default='0.0.0.0'),
239 ct.Cfg('horizon_port', ct.String(),
240 help="", default='5000'),
241 ct.Cfg('horizon_user', ct.String(),
242 help="", default='admin'),
243 ct.Cfg('horizon_password', ct.String(),
244 help="", default='workshop'),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200245]
246openstack_opts = [
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200247 ct.Cfg('openstack_installed', ct.Boolean(),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200248 help="", default=False),
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200249 ct.Cfg('openstack_keystone_endpoint', ct.String(),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300250 help="", default=''),
Tatyana Leontovichc08a54b2018-04-19 02:21:25 +0300251 ct.Cfg('horizon_check', ct.Boolean(),
Tatyana Leontovich69700712018-04-23 12:26:57 +0300252 help="", default=False),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300253]
254
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200255opencontrail_opts = [
256 ct.Cfg('opencontrail_tags', ct.String(),
257 help="", default=''),
258 ct.Cfg('opencontrail_features', ct.String(),
259 help="", default=''),
260 ct.Cfg('opencontrail_prepare_tests_steps_path', ct.String(),
261 help="Path to YAML with steps to prepare contrail-tests",
262 default=_default_opencontrail_prepare_tests_steps_path),
263]
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300264
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300265sl_deploy_opts = [
266 ct.Cfg('sl_steps_path', ct.String(),
267 help="Path to YAML with steps to deploy sl",
268 default=_default_sl_prepare_tests_steps_path),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300269 ct.Cfg('docker_image_alertmanager', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200270 default='{0}/openstack-docker/alertmanager:{1}'.format(
271 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Dmitry Kalashnik3eee60b2018-05-29 17:19:31 +0400272 ct.Cfg('docker_image_alerta', ct.String(),
273 default='{0}/mirantis/external/alerta-web:{1}'.format(
274 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300275 ct.Cfg('docker_image_pushgateway', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200276 default='{0}/openstack-docker/pushgateway:{1}'.format(
277 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300278 ct.Cfg('docker_image_prometheus', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200279 default='{0}/openstack-docker/prometheus:{1}'.format(
280 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300281 ct.Cfg('docker_image_remote_agent', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200282 default='{0}/openstack-docker/telegraf:{1}'.format(
283 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300284 ct.Cfg('docker_image_remote_storage_adapter', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200285 default='{0}/openstack-docker/remote_storage_adapter:{1}'.format(
286 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
287 ct.Cfg('docker_image_prometheus_relay', ct.String(),
288 default='{0}/openstack-docker/prometheus_relay:{1}'.format(
289 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
290 ct.Cfg('docker_image_grafana', ct.String(),
291 default='{0}/mirantis/external/grafana:{1}'.format(
292 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Dennis Dmitriev86f63e82017-11-09 00:07:45 +0200293 # SalesForce connection options for pushkin
Dennis Dmitrievce5ed8b2017-11-09 00:44:19 +0200294 ct.Cfg('sfdc_sandbox_enabled', ct.String(), default='False'),
Dennis Dmitriev86f63e82017-11-09 00:07:45 +0200295 ct.Cfg('sfdc_auth_url', ct.String(), default=''),
296 ct.Cfg('sfdc_username', ct.String(), default=''),
297 ct.Cfg('sfdc_password', ct.String(), default=''),
298 ct.Cfg('sfdc_consumer_key', ct.String(), default=''),
299 ct.Cfg('sfdc_consumer_secret', ct.String(), default=''),
300 ct.Cfg('sfdc_organization_id', ct.String(), default=''),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300301]
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300302
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300303sl_opts = [
Dennis Dmitrievfde667f2018-07-23 16:26:50 +0300304 ct.Cfg('stacklight_installed', ct.Boolean(),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300305 help="", default=False),
sgudzbf4de572017-11-23 14:37:01 +0200306 ct.Cfg('sl_version', ct.String(),
307 help="StackLight version. Could be 1 or 2", default=''),
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300308 ct.Cfg('sl_vip_host', ct.IPAddress(),
309 help="Vip address for SL services", default='0.0.0.0'),
310 ct.Cfg('sl_prometheus_port', ct.String(),
311 help="Prometheus port", default='15010'),
312 ct.Cfg('sl_prometheus_proto', ct.String(),
313 help="Proemtheus protocol", default='http'),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300314]
315
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200316ceph_deploy_opts = [
317 ct.Cfg('ceph_steps_path', ct.String(),
318 help="Path to YAML with steps to deploy sl",
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200319 default=_default_ceph_prepare_tests_steps_path),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200320]
321
322ceph_opts = [
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200323 ct.Cfg('ceph_installed', ct.Boolean(),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200324 help="", default=False),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200325]
326
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300327k8s_deploy_opts = [
Artem Panchenko0594cd72017-06-12 13:25:26 +0300328 ct.Cfg('k8s_steps_path', ct.String(),
329 help="Path to YAML with steps to deploy Kubernetes",
330 default=_default_k8s_steps),
Vladimir Jigulin62bcf462018-05-28 18:17:01 +0400331 ct.Cfg('k8s_update_steps_path', ct.String(),
332 help="Path to YAML with steps to update Kubernetes",
333 default=_default_k8s_update_steps),
Artem Panchenko0594cd72017-06-12 13:25:26 +0300334 ct.Cfg('kubernetes_admin_user', ct.String(), default='admin'),
335 ct.Cfg('kubernetes_admin_password', ct.String(),
336 default='sbPfel23ZigJF3Bm'),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300337 ct.Cfg('kubernetes_docker_package', ct.String(), default=''),
Victor Ryzhenkine784bbf2018-12-21 03:58:00 +0400338 ct.Cfg('kubernetes_hyperkube_source', ct.String(),
339 default='{}/mirantis/kubernetes/hyperkube-binaries/'
340 'hyperkube_v1.12.3-2_1544133573591'.format(
341 settings.BINARY_REGISTRY)),
342 ct.Cfg('kubernetes_hyperkube_source_hash', ct.String(),
343 default='md5=fc23eaf3ba63d9ed9d141f465f584012'),
Victor Ryzhenkin2687fa12018-05-24 16:28:17 +0400344 ct.Cfg('kubernetes_pause_image', ct.String(),
Victor Ryzhenkine784bbf2018-12-21 03:58:00 +0400345 default='{}/mirantis/kubernetes/pause-amd64:v1.12.3-2'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300346 settings.DOCKER_REGISTRY)),
347 ct.Cfg('kubernetes_calico_image', ct.String(),
Aleksei Kasatkin00fd9e02019-01-09 11:05:35 +0100348 default='{}/mirantis/projectcalico/calico/node:v3.3.2'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300349 settings.DOCKER_REGISTRY)),
Victor Ryzhenkin53f1b492018-05-09 17:30:17 +0400350 ct.Cfg('kubernetes_calico_calicoctl_image', ct.String(),
Aleksei Kasatkin00fd9e02019-01-09 11:05:35 +0100351 default='{}/mirantis/projectcalico/calico/ctl:v3.3.2'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300352 settings.DOCKER_REGISTRY)),
353 ct.Cfg('kubernetes_calico_cni_image', ct.String(),
Aleksei Kasatkin00fd9e02019-01-09 11:05:35 +0100354 default='{}/mirantis/projectcalico/calico/cni:v3.3.2'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300355 settings.DOCKER_REGISTRY)),
Aleksei Kasatkin1d252f02018-08-29 13:15:58 +0200356 ct.Cfg('kubernetes_calico_kube_controllers_image', ct.String(),
357 default='{}/mirantis/projectcalico/calico/kube-controllers:'
Aleksei Kasatkin00fd9e02019-01-09 11:05:35 +0100358 'v3.3.2'.format(settings.DOCKER_REGISTRY)),
359 ct.Cfg('kubernetes_calico_calicoctl_source', ct.String(),
360 default='{}/mirantis/projectcalico/calicoctl/'
361 'calicoctl-v3.3.2'.format(
362 settings.BINARY_REGISTRY)),
363 ct.Cfg('kubernetes_calico_calicoctl_source_hash', ct.String(),
364 default='md5=bb38517fdd6b8bb7c130ae7550a9d335'),
365 ct.Cfg('kubernetes_calico_birdcl_source', ct.String(),
366 default='{}/mirantis/projectcalico/bird/'
367 'birdcl-v0.3.3'.format(
368 settings.BINARY_REGISTRY)),
369 ct.Cfg('kubernetes_calico_birdcl_source_hash', ct.String(),
370 default='md5=0327442efd2592ddce449b66c5d0fc9d'),
371 ct.Cfg('kubernetes_calico_cni_source', ct.String(),
372 default='{}/mirantis/projectcalico/cni-plugin/'
373 'calico-v3.3.2'.format(
374 settings.BINARY_REGISTRY)),
375 ct.Cfg('kubernetes_calico_cni_source_hash', ct.String(),
376 default='md5=2544bc1865c1451cac7a61264c25a2cb'),
377 ct.Cfg('kubernetes_calico_cni_ipam_source', ct.String(),
378 default='{}/mirantis/projectcalico/cni-plugin/'
379 'calico-ipam-v3.3.2'.format(
380 settings.BINARY_REGISTRY)),
381 ct.Cfg('kubernetes_calico_cni_ipam_source_hash', ct.String(),
382 default='md5=b22623eeea3b29ba8ec071d859ac7055'),
Artem Panchenko0594cd72017-06-12 13:25:26 +0300383 ct.Cfg('kubernetes_netchecker_enabled', ct.Boolean(),
384 help="", default=True),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300385 ct.Cfg('kubernetes_netchecker_agent_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200386 default='mirantis/k8s-netchecker-agent:v1.2.2'),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300387 ct.Cfg('kubernetes_netchecker_server_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200388 default='mirantis/k8s-netchecker-server:v1.2.2'),
Artem Panchenko501e67e2017-06-14 14:59:18 +0300389 ct.Cfg('kubernetes_calico_policy_enabled', ct.Boolean(),
390 help="", default=False),
Artem Panchenko501e67e2017-06-14 14:59:18 +0300391 ct.Cfg('kubernetes_helm_enabled', ct.Boolean(),
Tatyana Leontovich038dc7d2017-09-22 16:25:59 +0300392 help="", default=False),
Victor Ryzhenkin0bf0bb02017-07-06 18:57:05 +0400393 ct.Cfg('kubernetes_virtlet_enabled', ct.Boolean(),
Tatyana Leontovich038dc7d2017-09-22 16:25:59 +0300394 help="", default=False),
Victor Ryzhenkin0bf0bb02017-07-06 18:57:05 +0400395 ct.Cfg('kubernetes_virtlet_image', ct.String(),
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400396 help="", default='mirantis/virtlet:v1.4.1'),
Victor Ryzhenkin5902ae62018-09-11 20:34:54 +0400397 ct.Cfg('kubernetes_dns', ct.Boolean(),
398 help="", default=True),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400399 ct.Cfg('kubernetes_externaldns_enabled', ct.Boolean(),
400 help="", default=False),
401 ct.Cfg('kubernetes_externaldns_image', ct.String(),
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400402 help="", default='{}/mirantis/external-dns/external-dns:'
403 'v0.5.6-2'.format(settings.DOCKER_REGISTRY)),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400404 ct.Cfg('kubernetes_externaldns_provider', ct.String(),
405 help="", default='coredns'),
406 ct.Cfg('kubernetes_coredns_enabled', ct.Boolean(),
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400407 help="", default=True),
Vladimir Jigulina6b018b2018-07-18 15:19:01 +0400408 ct.Cfg('kubernetes_metallb_enabled', ct.Boolean(),
409 help="", default=False),
Vladimir Jigulin5775bbb2018-10-03 10:34:54 +0400410 ct.Cfg('kubernetes_ingressnginx_enabled', ct.Boolean(),
411 help="", default=False),
Victor Ryzhenkin2a5806e2017-12-18 20:23:53 +0400412 ct.Cfg('kubelet_fail_on_swap', ct.Boolean(),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400413 help="", default=False)
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300414]
415
416k8s_opts = [
Artem Panchenko0594cd72017-06-12 13:25:26 +0300417 ct.Cfg('k8s_installed', ct.Boolean(),
418 help="", default=False),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300419 ct.Cfg('kube_host', ct.IPAddress(),
420 help="", default='0.0.0.0'),
421 ct.Cfg('kube_apiserver_port', ct.Integer(),
422 help="", default=443),
vrovacheva9d08332017-06-22 20:01:59 +0400423 ct.Cfg("k8s_conformance_run", ct.Boolean(),
424 default=False),
Victor Ryzhenkin8ff3c3f2018-01-17 19:37:05 +0400425 ct.Cfg("run_extended_virtlet_conformance", ct.Boolean(),
426 default=False),
vrovacheva9d08332017-06-22 20:01:59 +0400427 ct.Cfg('k8s_conformance_image', ct.String(),
Dennis Dmitriev75776c52017-12-26 18:22:53 +0200428 default='docker-prod-virtual.docker.mirantis.net/mirantis/'
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400429 'kubernetes/k8s-conformance:v1.11.3-2'),
Vladimir Jigulin62bcf462018-05-28 18:17:01 +0400430 ct.Cfg('k8s_update_chain', ct.String(),
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400431 default='v1.9.8-4 v1.10.4-4 v1.11.3-2')
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300432]
433
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +0200434day1_cfg_config_opts = [
435 ct.Cfg('configure_steps_path', ct.String(),
436 help="Path to YAML with steps to config cfg01 node",
437 default=_default_configure_steps),
438 ct.Cfg('environment_template_dir', ct.String(),
439 help="Path to directory with Environment template and inventory",
440 default=_default_environment_template_dir),
441 ct.Cfg('templates_dir', ct.String(),
442 help="Path to directory with templates",
443 default=_default_templates_dir),
444 ct.Cfg('cluster_maas_config', ct.String(),
445 help="Path to maas class yaml file for cfg node",
446 default=_default_cluster_maas_config),
447 ct.Cfg('maas_machines_macs', ct.JSONDict(),
448 help="""MAC of machines interfaces for maas config:
449 'parameters': {
450 'maas' : {
451 'region' : {
452 'machines': {
453 'ctl01': {
454 'interface': {
455 'mac': 'aa:bb:cc:dd:ee:ff'
456 }
457 }
458 '...': {
459 'interface': {
460 'mac': 'aa:bb:cc:dd:ee:ff'
461 }
462 }
463 }}}}""", default={}),
464]
465
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300466_group_opts = [
467 ('hardware', hardware_opts),
468 ('underlay', underlay_opts),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200469 ('salt_deploy', salt_deploy_opts),
470 ('salt', salt_opts),
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300471 ('core_deploy', core_deploy_opts),
472 ('core', core_opts),
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300473 ('oss_deploy', oss_deploy_opts),
474 ('oss', oss_opts),
sgudzb67ce732018-02-13 17:58:31 +0200475 ('drivetrain_deploy', drivetrain_deploy_opts),
476 ('drivetrain', drivetrain_opts),
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300477 ('decapod_deploy', decapod_deploy_opts),
478 ('decapod', decapod_opts),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200479 ('openstack_deploy', openstack_deploy_opts),
480 ('openstack', openstack_opts),
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200481 ('opencontrail', opencontrail_opts),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300482 ('stack_light', sl_opts),
483 ('sl_deploy', sl_deploy_opts),
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200484 ('ceph', ceph_opts),
485 ('ceph_deploy', ceph_deploy_opts),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300486 ('k8s_deploy', k8s_deploy_opts),
487 ('k8s', k8s_opts),
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +0200488 ('day1_cfg_config', day1_cfg_config_opts),
489 ('day1_underlay', underlay_opts),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300490]
491
492
493def register_opts(config):
494 config.register_group(cfg.OptGroup(name='hardware',
495 title="Hardware settings", help=""))
496 config.register_opts(group='hardware', opts=hardware_opts)
497
498 config.register_group(cfg.OptGroup(name='underlay',
499 title="Underlay configuration", help=""))
500 config.register_opts(group='underlay', opts=underlay_opts)
501
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200502 config.register_group(cfg.OptGroup(name='salt_deploy',
503 title="salt deploy configuration", help=""))
504 config.register_opts(group='salt_deploy', opts=salt_deploy_opts)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300505
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200506 config.register_group(cfg.OptGroup(name='salt',
507 title="salt config and credentials", help=""))
508 config.register_opts(group='salt', opts=salt_opts)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300509
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300510 config.register_group(cfg.OptGroup(name='core',
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200511 title="Common services for Openstack", help=""))
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300512 config.register_opts(group='core', opts=core_opts)
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200513
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300514 config.register_group(
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300515 cfg.OptGroup(name='core_deploy',
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200516 title="Common services for Openstack deploy config",
517 help=""))
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300518 config.register_opts(group='core_deploy',
519 opts=core_deploy_opts)
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200520
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300521 config.register_group(cfg.OptGroup(name='oss',
522 title="Operational Support System Tools", help=""))
523 config.register_opts(group='oss', opts=oss_opts)
524
525 config.register_group(cfg.OptGroup(name='oss_deploy',
526 title="OSS deploy config", help=""))
527 config.register_opts(group='oss_deploy',
528 opts=oss_deploy_opts)
529
sgudzb67ce732018-02-13 17:58:31 +0200530 config.register_group(cfg.OptGroup(name='drivetrain',
531 title="Drivetrain Tools", help=""))
532 config.register_opts(group='drivetrain', opts=drivetrain_opts)
533
534 config.register_group(cfg.OptGroup(name='drivetrain_deploy',
535 title="Drivetrain deploy config", help=""))
536 config.register_opts(group='drivetrain_deploy',
537 opts=drivetrain_deploy_opts)
538
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300539 config.register_group(cfg.OptGroup(name='decapod',
540 title="Decapod options for Ceph", help=""))
541 config.register_opts(group='decapod', opts=decapod_opts)
542
543 config.register_group(cfg.OptGroup(name='decapod_deploy',
544 title="Decapod deploy config", help=""))
545 config.register_opts(group='decapod_deploy',
546 opts=decapod_deploy_opts)
547
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200548 config.register_group(cfg.OptGroup(name='openstack',
549 title="Openstack config and credentials", help=""))
550 config.register_opts(group='openstack', opts=openstack_opts)
551
552 config.register_group(
553 cfg.OptGroup(name='openstack_deploy',
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300554 title="Openstack deploy config and credentials",
555 help=""))
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200556 config.register_opts(group='openstack_deploy', opts=openstack_deploy_opts)
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200557
558 config.register_group(cfg.OptGroup(name='opencontrail',
559 title="Options for Juniper contrail-tests", help=""))
560 config.register_opts(group='opencontrail', opts=opencontrail_opts)
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +0300561 config.register_group(
562 cfg.OptGroup(name='stack_light',
563 title="StackLight config and credentials", help=""))
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300564 config.register_opts(group='stack_light', opts=sl_opts)
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300565 config.register_group(
566 cfg.OptGroup(name='sl_deploy',
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300567 title="SL deploy config and credentials",
568 help=""))
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300569 config.register_opts(group='sl_deploy', opts=sl_deploy_opts)
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300570
571 config.register_group(cfg.OptGroup(name='k8s_deploy',
572 title="K8s deploy configuration"))
573 config.register_opts(group='k8s_deploy', opts=k8s_deploy_opts)
574
575 config.register_group(cfg.OptGroup(name='k8s',
576 title="K8s config and credentials"))
577 config.register_opts(group='k8s', opts=k8s_opts)
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200578 config.register_group(cfg.OptGroup(name='ceph',
579 title="ceph config", help=""))
580 config.register_opts(group='ceph', opts=ceph_opts)
581
582 config.register_group(
583 cfg.OptGroup(name='ceph_deploy',
584 title="Ceph deploy config ",
585 help=""))
586 config.register_opts(group='ceph_deploy', opts=ceph_deploy_opts)
587
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +0200588 config.register_group(cfg.OptGroup(name='day1_cfg_config',
589 title="Day01 config node configuration", help=""))
590 config.register_opts(group='day1_cfg_config', opts=day1_cfg_config_opts)
591
592 config.register_group(cfg.OptGroup(name='day1_underlay',
593 title="Day01 underlay configuration", help=""))
594 config.register_opts(group='day1_underlay', opts=underlay_opts)
595
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300596 return config
597
598
599def load_config(config_files):
600 config = cfg.CONF
601 register_opts(config)
602 config(args=[], default_config_files=config_files)
603 return config
604
605
606def reload_snapshot_config(config, test_config_path):
607 """Reset config to the state from test_config file"""
608 config(args=[], default_config_files=[test_config_path])
609 return config
610
611
612def list_opts():
613 """Return a list of oslo.config options available in the tcp_tests.
614 """
615 return [(group, copy.deepcopy(opts)) for group, opts in _group_opts]
616
617
618def list_current_opts(config):
619 """Return a list of oslo.config options available in the tcp_tests.
620 """
621 result_opts = []
622 for group, opts in _group_opts:
623 current_opts = copy.deepcopy(opts)
624 for opt in current_opts:
625 if hasattr(config, group):
626 if hasattr(config[group], opt.name):
627 opt.default = getattr(config[group], opt.name)
628 result_opts.append((group, current_opts))
629 return result_opts
630
631
632def save_config(config, snapshot_name, env_name=None):
633 if env_name is None:
634 env_name = 'config'
635 test_config_path = os.path.join(
636 settings.LOGS_DIR, '{0}_{1}.ini'.format(env_name, snapshot_name))
637
638 with open(test_config_path, 'w') as output_file:
639 formatter = generator._OptFormatter(output_file=output_file)
640 for group, opts in list_current_opts(config):
641 formatter.format_group(group)
642 for opt in opts:
643 formatter.format(opt, group, minimal=True)
644 formatter.write('\n')
645 formatter.write('\n')