blob: 5717875487af9edfe73742aed0acca5b9cce8486 [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 Dmitrievf5f2e602017-11-03 15:36:19 +020030_default_heat_conf = pkg_resources.resource_filename(
31 __name__, 'templates/{0}/underlay.hot'.format(settings.LAB_CONFIG_NAME))
32_default_heat_env = pkg_resources.resource_filename(
33 __name__, 'templates/_heat_environments/microcloud-8116.env')
Dennis Dmitriev6860ba62016-11-01 21:43:46 +020034
35_default_salt_steps = pkg_resources.resource_filename(
Dennis Dmitrievab83ea42017-05-12 16:52:45 +030036 __name__, 'templates/{0}/salt.yaml'.format(settings.LAB_CONFIG_NAME))
Dennis Dmitriev9dada8a2017-08-30 17:38:55 +030037_default_environment_template_dir = pkg_resources.resource_filename(
38 __name__, 'environment/')
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +030039_default_templates_dir = pkg_resources.resource_filename(
40 __name__, 'templates/')
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030041_default_core_steps = pkg_resources.resource_filename(
Dennis Dmitriev6860ba62016-11-01 21:43:46 +020042 __name__,
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030043 'templates/{0}/core.yaml'.format(
Dennis Dmitriev2a13a132016-11-04 00:56:23 +020044 settings.LAB_CONFIG_NAME))
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +030045_default_oss_steps = pkg_resources.resource_filename(
46 __name__,
47 'templates/{0}/oss.yaml'.format(
48 settings.LAB_CONFIG_NAME))
sgudzb67ce732018-02-13 17:58:31 +020049_default_drivetrain_steps = pkg_resources.resource_filename(
50 __name__,
51 'templates/{0}/drivetrain.yaml'.format(
52 settings.LAB_CONFIG_NAME))
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +030053_default_decapod_steps = pkg_resources.resource_filename(
54 __name__,
55 'templates/{0}/decapod.yaml'.format(
56 settings.LAB_CONFIG_NAME))
Dennis Dmitriev6860ba62016-11-01 21:43:46 +020057_default_openstack_steps = pkg_resources.resource_filename(
Dennis Dmitrievab83ea42017-05-12 16:52:45 +030058 __name__, 'templates/{0}/openstack.yaml'.format(
Dennis Dmitriev2a13a132016-11-04 00:56:23 +020059 settings.LAB_CONFIG_NAME))
Tatyana Leontovich8dbc7882018-08-29 13:11:16 +030060_default_openstack_resources_steps = pkg_resources.resource_filename(
61 __name__, 'templates/{0}/post_openstack.yaml'.format(
62 settings.LAB_CONFIG_NAME))
Dina Belovae6fdffb2017-09-19 13:58:34 -070063_default_opencontrail_prepare_tests_steps_path = \
64 pkg_resources.resource_filename(
65 __name__, 'templates/{0}/opencontrail.yaml'.format(
66 settings.LAB_CONFIG_NAME))
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030067_default_sl_prepare_tests_steps_path = pkg_resources.resource_filename(
68 __name__, 'templates/{0}/sl.yaml'.format(
69 settings.LAB_CONFIG_NAME))
Tatyana Leontovich460f7df2017-11-13 15:45:06 +020070_default_ceph_prepare_tests_steps_path = pkg_resources.resource_filename(
71 __name__, 'templates/{0}/ceph.yaml'.format(
72 settings.LAB_CONFIG_NAME))
Artem Panchenko0594cd72017-06-12 13:25:26 +030073_default_k8s_steps = pkg_resources.resource_filename(
74 __name__, 'templates/{0}/k8s.yaml'.format(
75 settings.LAB_CONFIG_NAME))
Vladimir Jigulin62bcf462018-05-28 18:17:01 +040076_default_k8s_update_steps = pkg_resources.resource_filename(
77 __name__, 'templates/{0}/k8s-update.yaml'.format(
78 settings.LAB_CONFIG_NAME))
Dmitry Tyzhnenkob8641832017-11-07 17:02:47 +020079_default_net_mgm = os.environ.get("NET_MGMT", "admin-pool01")
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +020080_default_configure_steps = pkg_resources.resource_filename(
81 __name__, 'templates/{0}/cfg01_configure.yaml'.format(
82 settings.LAB_CONFIG_NAME))
83# _default_cluster_maas_config = pkg_resources.resource_filename(
84# __name__, 'templates/{0}/cluster_infra_maas.yml'.format(
85# settings.LAB_CONFIG_NAME))
86_default_cluster_maas_config = 'cluster_infra_maas.yml'
Dennis Dmitriev6f59add2016-10-18 13:45:27 +030087
88hardware_opts = [
89 ct.Cfg('manager', ct.String(),
90 help="Hardware manager name", default="devops"),
91 ct.Cfg('conf_path', ct.String(),
92 help="Hardware config file", default=_default_conf),
93 ct.Cfg('current_snapshot', ct.String(),
94 help="Latest environment status name",
95 default=ext.SNAPSHOT.hardware),
Dennis Dmitrievf5f2e602017-11-03 15:36:19 +020096
97 ct.Cfg('heat_stack_name', ct.String(),
98 help="Heat stack name", default=''),
99 ct.Cfg('heat_conf_path', ct.String(),
100 help="Heat template file", default=_default_heat_conf),
101 ct.Cfg('heat_env_path', ct.String(),
102 help="Heat environment parameters file", default=_default_heat_env),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300103]
104
105
106underlay_opts = [
107 ct.Cfg('ssh', ct.JSONList(),
108 help="""SSH Settings for Underlay: [{
109 'node_name': node1,
Dennis Dmitriev83cc1d52018-11-09 15:35:30 +0200110 'minion_id': node1.local,
Dennis Dmitriev23e5d192016-10-31 11:27:10 +0200111 'roles': ['salt-master', 'salt-minion', ],
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300112 'host': hostname,
113 'login': login,
114 'password': password,
115 'address_pool': (optional),
116 'port': (optional),
117 'keys': [(optional)],
118 }, ...]""", default=[]),
119 ct.Cfg('roles', ct.JSONList(),
120 help="Node roles managed by underlay in the environment",
Dennis Dmitriev53d3b772016-10-18 14:31:58 +0300121 default=[ext.UNDERLAY_NODE_ROLES.salt_master,
vrovachev99228d32017-06-08 19:46:10 +0400122 ext.UNDERLAY_NODE_ROLES.salt_minion,
Victor Ryzhenkin66d39372017-09-28 19:25:48 +0400123 ext.UNDERLAY_NODE_ROLES.k8s_controller]),
Dennis Dmitriev7b9538f2017-05-15 17:01:34 +0300124 ct.Cfg('bootstrap_timeout', ct.Integer(),
125 help="Timeout of waiting SSH for nodes with specified roles",
Dennis Dmitriev4558ee92018-01-31 08:14:08 -0400126 default=600),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300127 ct.Cfg('nameservers', ct.JSONList(),
128 help="IP addresses of DNS servers",
129 default=[]),
130 ct.Cfg('upstream_dns_servers', ct.JSONList(),
131 help="IP addresses of upstream DNS servers (dnsmasq)",
132 default=[]),
Dennis Dmitriev99b26fe2017-04-26 12:34:44 +0300133 ct.Cfg('address_pools', ct.JSONDict(),
134 help="""Address pools (dynamically) allocated for the environment.
135 May be used to determine CIDR for a specific network from
136 tests or during the deployment process.
137 {'pool_name1': '<cidr>', 'pool_name2': '<cidr>', ...}""",
138 default={}),
Dennis Dmitrievb6bcc5c2018-09-26 11:07:53 +0000139 ct.Cfg('dhcp_ranges', ct.JSONDict(),
140 help="""DHCP ranges allocated for the address pools.
141 This is extended object comparing to 'address_pools'.
142 May be used to determine DHCP range start/end/gateway for a
143 specific network from tests or during the deployment
144 process.
145 {'pool_name1': {'cidr': 'n.n.n.n/m',
146 'start': 'x.x.x.x',
147 'end': 'y.y.y.y',
148 'gateway': 'z.z.z.z'},
149 'pool_name2': {'cidr': 'n.n.n.n/m',
150 'start': x.x.x.x,
151 'end': 'y.y.y.y',
152 'gateway': 'z.z.z.z'},
153 ...}""",
154 default={}),
Artem Panchenkodb0a97f2017-06-27 19:09:13 +0300155 ct.Cfg('ssh_keys', ct.JSONList(), default=[],
156 help="SSH key pair(s) for root. If the option is left empty, "
157 "then a key pair will be generated automatically"),
158 ct.Cfg('ssh_key_file', ct.String(), default=os.path.abspath('./id_rsa'),
159 help='Path (local) to file with private key authorized on nodes'),
Dmitry Tyzhnenkob8641832017-11-07 17:02:47 +0200160 ct.Cfg('net_mgmt', ct.String(), default=_default_net_mgm)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300161]
162
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200163
164salt_deploy_opts = [
165 ct.Cfg('salt_steps_path', ct.String(),
166 help="Path to YAML with steps to deploy salt",
167 default=_default_salt_steps),
Dennis Dmitriev9dada8a2017-08-30 17:38:55 +0300168 ct.Cfg('environment_template_dir', ct.String(),
169 help="Path to directory with Environment template and inventory",
170 default=_default_environment_template_dir),
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +0300171 ct.Cfg('templates_dir', ct.String(),
172 help="Path to directory with templates",
173 default=_default_templates_dir),
Dennis Dmitriev5bcbdc52018-03-23 18:05:10 +0200174 ct.Cfg('salt_roles', ct.JSONList(),
175 help="Node roles to install salt-minions and manage by salt",
176 default=[ext.UNDERLAY_NODE_ROLES.salt_master,
177 ext.UNDERLAY_NODE_ROLES.salt_minion,
178 ext.UNDERLAY_NODE_ROLES.k8s_controller]),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300179]
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200180salt_opts = [
181 ct.Cfg('salt_master_host', ct.IPAddress(),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300182 help="", default='0.0.0.0'),
Dennis Dmitriev2d60c8e2017-05-12 18:34:01 +0300183 ct.Cfg('salt_master_port', ct.String(),
184 help="", default='6969'),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300185]
186
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300187core_deploy_opts = [
188 ct.Cfg('core_steps_path', ct.String(),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200189 help="Path to YAML with steps to deploy common services",
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300190 default=_default_core_steps),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300191]
192
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300193core_opts = [
194 ct.Cfg('core_installed', ct.Boolean(),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200195 help="", default=False),
196]
197
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300198oss_deploy_opts = [
199 ct.Cfg('oss_steps_path', ct.String(),
200 help="Path to YAML with steps to deploy OSS Tools",
201 default=_default_oss_steps),
202]
203
204oss_opts = [
205 ct.Cfg('oss_installed', ct.Boolean(),
206 help="", default=False),
207]
208
sgudzb67ce732018-02-13 17:58:31 +0200209drivetrain_deploy_opts = [
210 ct.Cfg('drivetrain_steps_path', ct.String(),
211 help="Path to YAML with steps to deploy Drivetrain",
212 default=_default_drivetrain_steps),
213]
214
215drivetrain_opts = [
216 ct.Cfg('drivetrain_installed', ct.Boolean(),
217 help="", default=False),
218]
219
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300220decapod_deploy_opts = [
221 ct.Cfg('decapod_steps_path', ct.String(),
222 help="Path to YAML with steps to deploy Ceph with Decapod",
223 default=_default_decapod_steps),
224]
225
226decapod_opts = [
227 ct.Cfg('decapod_installed', ct.Boolean(),
228 help="", default=False),
229]
230
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200231openstack_deploy_opts = [
232 ct.Cfg('openstack_steps_path', ct.String(),
233 help="Path to YAML with steps to deploy openstack",
234 default=_default_openstack_steps),
Tatyana Leontovich8dbc7882018-08-29 13:11:16 +0300235 ct.Cfg('openstack_resources_steps_path', ct.String(),
236 help="Path to YAML with steps to deploy openstack",
237 default=_default_openstack_resources_steps),
Tatyana Leontovichc72604d2018-01-04 17:58:00 +0200238 ct.Cfg('horizon_host', ct.IPAddress(),
239 help="", default='0.0.0.0'),
240 ct.Cfg('horizon_port', ct.String(),
241 help="", default='5000'),
242 ct.Cfg('horizon_user', ct.String(),
243 help="", default='admin'),
244 ct.Cfg('horizon_password', ct.String(),
245 help="", default='workshop'),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200246]
247openstack_opts = [
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200248 ct.Cfg('openstack_installed', ct.Boolean(),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200249 help="", default=False),
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200250 ct.Cfg('openstack_keystone_endpoint', ct.String(),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300251 help="", default=''),
Tatyana Leontovichc08a54b2018-04-19 02:21:25 +0300252 ct.Cfg('horizon_check', ct.Boolean(),
Tatyana Leontovich69700712018-04-23 12:26:57 +0300253 help="", default=False),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300254]
255
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200256opencontrail_opts = [
257 ct.Cfg('opencontrail_tags', ct.String(),
258 help="", default=''),
259 ct.Cfg('opencontrail_features', ct.String(),
260 help="", default=''),
261 ct.Cfg('opencontrail_prepare_tests_steps_path', ct.String(),
262 help="Path to YAML with steps to prepare contrail-tests",
263 default=_default_opencontrail_prepare_tests_steps_path),
264]
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300265
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300266sl_deploy_opts = [
267 ct.Cfg('sl_steps_path', ct.String(),
268 help="Path to YAML with steps to deploy sl",
269 default=_default_sl_prepare_tests_steps_path),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300270 ct.Cfg('docker_image_alertmanager', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200271 default='{0}/openstack-docker/alertmanager:{1}'.format(
272 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Dmitry Kalashnik3eee60b2018-05-29 17:19:31 +0400273 ct.Cfg('docker_image_alerta', ct.String(),
274 default='{0}/mirantis/external/alerta-web:{1}'.format(
275 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300276 ct.Cfg('docker_image_pushgateway', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200277 default='{0}/openstack-docker/pushgateway:{1}'.format(
278 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300279 ct.Cfg('docker_image_prometheus', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200280 default='{0}/openstack-docker/prometheus:{1}'.format(
281 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300282 ct.Cfg('docker_image_remote_agent', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200283 default='{0}/openstack-docker/telegraf:{1}'.format(
284 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300285 ct.Cfg('docker_image_remote_storage_adapter', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200286 default='{0}/openstack-docker/remote_storage_adapter:{1}'.format(
287 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
288 ct.Cfg('docker_image_prometheus_relay', ct.String(),
289 default='{0}/openstack-docker/prometheus_relay:{1}'.format(
290 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
291 ct.Cfg('docker_image_grafana', ct.String(),
292 default='{0}/mirantis/external/grafana:{1}'.format(
293 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Dennis Dmitriev86f63e82017-11-09 00:07:45 +0200294 # SalesForce connection options for pushkin
Dennis Dmitrievce5ed8b2017-11-09 00:44:19 +0200295 ct.Cfg('sfdc_sandbox_enabled', ct.String(), default='False'),
Dennis Dmitriev86f63e82017-11-09 00:07:45 +0200296 ct.Cfg('sfdc_auth_url', ct.String(), default=''),
297 ct.Cfg('sfdc_username', ct.String(), default=''),
298 ct.Cfg('sfdc_password', ct.String(), default=''),
299 ct.Cfg('sfdc_consumer_key', ct.String(), default=''),
300 ct.Cfg('sfdc_consumer_secret', ct.String(), default=''),
301 ct.Cfg('sfdc_organization_id', ct.String(), default=''),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300302]
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300303
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300304sl_opts = [
Dennis Dmitrievfde667f2018-07-23 16:26:50 +0300305 ct.Cfg('stacklight_installed', ct.Boolean(),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300306 help="", default=False),
sgudzbf4de572017-11-23 14:37:01 +0200307 ct.Cfg('sl_version', ct.String(),
308 help="StackLight version. Could be 1 or 2", default=''),
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300309 ct.Cfg('sl_vip_host', ct.IPAddress(),
310 help="Vip address for SL services", default='0.0.0.0'),
311 ct.Cfg('sl_prometheus_port', ct.String(),
312 help="Prometheus port", default='15010'),
313 ct.Cfg('sl_prometheus_proto', ct.String(),
314 help="Proemtheus protocol", default='http'),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300315]
316
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200317ceph_deploy_opts = [
318 ct.Cfg('ceph_steps_path', ct.String(),
319 help="Path to YAML with steps to deploy sl",
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200320 default=_default_ceph_prepare_tests_steps_path),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200321]
322
323ceph_opts = [
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200324 ct.Cfg('ceph_installed', ct.Boolean(),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200325 help="", default=False),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200326]
327
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300328k8s_deploy_opts = [
Artem Panchenko0594cd72017-06-12 13:25:26 +0300329 ct.Cfg('k8s_steps_path', ct.String(),
330 help="Path to YAML with steps to deploy Kubernetes",
331 default=_default_k8s_steps),
Vladimir Jigulin62bcf462018-05-28 18:17:01 +0400332 ct.Cfg('k8s_update_steps_path', ct.String(),
333 help="Path to YAML with steps to update Kubernetes",
334 default=_default_k8s_update_steps),
Artem Panchenko0594cd72017-06-12 13:25:26 +0300335 ct.Cfg('kubernetes_admin_user', ct.String(), default='admin'),
336 ct.Cfg('kubernetes_admin_password', ct.String(),
337 default='sbPfel23ZigJF3Bm'),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300338 ct.Cfg('kubernetes_docker_package', ct.String(), default=''),
Victor Ryzhenkine784bbf2018-12-21 03:58:00 +0400339 ct.Cfg('kubernetes_hyperkube_source', ct.String(),
340 default='{}/mirantis/kubernetes/hyperkube-binaries/'
341 'hyperkube_v1.12.3-2_1544133573591'.format(
342 settings.BINARY_REGISTRY)),
343 ct.Cfg('kubernetes_hyperkube_source_hash', ct.String(),
344 default='md5=fc23eaf3ba63d9ed9d141f465f584012'),
Victor Ryzhenkin2687fa12018-05-24 16:28:17 +0400345 ct.Cfg('kubernetes_pause_image', ct.String(),
Victor Ryzhenkine784bbf2018-12-21 03:58:00 +0400346 default='{}/mirantis/kubernetes/pause-amd64:v1.12.3-2'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300347 settings.DOCKER_REGISTRY)),
348 ct.Cfg('kubernetes_calico_image', ct.String(),
Aleksei Kasatkin00fd9e02019-01-09 11:05:35 +0100349 default='{}/mirantis/projectcalico/calico/node:v3.3.2'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300350 settings.DOCKER_REGISTRY)),
Victor Ryzhenkin53f1b492018-05-09 17:30:17 +0400351 ct.Cfg('kubernetes_calico_calicoctl_image', ct.String(),
Aleksei Kasatkin00fd9e02019-01-09 11:05:35 +0100352 default='{}/mirantis/projectcalico/calico/ctl:v3.3.2'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300353 settings.DOCKER_REGISTRY)),
354 ct.Cfg('kubernetes_calico_cni_image', ct.String(),
Aleksei Kasatkin00fd9e02019-01-09 11:05:35 +0100355 default='{}/mirantis/projectcalico/calico/cni:v3.3.2'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300356 settings.DOCKER_REGISTRY)),
Aleksei Kasatkin1d252f02018-08-29 13:15:58 +0200357 ct.Cfg('kubernetes_calico_kube_controllers_image', ct.String(),
358 default='{}/mirantis/projectcalico/calico/kube-controllers:'
Aleksei Kasatkin00fd9e02019-01-09 11:05:35 +0100359 'v3.3.2'.format(settings.DOCKER_REGISTRY)),
360 ct.Cfg('kubernetes_calico_calicoctl_source', ct.String(),
361 default='{}/mirantis/projectcalico/calicoctl/'
362 'calicoctl-v3.3.2'.format(
363 settings.BINARY_REGISTRY)),
364 ct.Cfg('kubernetes_calico_calicoctl_source_hash', ct.String(),
365 default='md5=bb38517fdd6b8bb7c130ae7550a9d335'),
366 ct.Cfg('kubernetes_calico_birdcl_source', ct.String(),
367 default='{}/mirantis/projectcalico/bird/'
368 'birdcl-v0.3.3'.format(
369 settings.BINARY_REGISTRY)),
370 ct.Cfg('kubernetes_calico_birdcl_source_hash', ct.String(),
371 default='md5=0327442efd2592ddce449b66c5d0fc9d'),
372 ct.Cfg('kubernetes_calico_cni_source', ct.String(),
373 default='{}/mirantis/projectcalico/cni-plugin/'
374 'calico-v3.3.2'.format(
375 settings.BINARY_REGISTRY)),
376 ct.Cfg('kubernetes_calico_cni_source_hash', ct.String(),
377 default='md5=2544bc1865c1451cac7a61264c25a2cb'),
378 ct.Cfg('kubernetes_calico_cni_ipam_source', ct.String(),
379 default='{}/mirantis/projectcalico/cni-plugin/'
380 'calico-ipam-v3.3.2'.format(
381 settings.BINARY_REGISTRY)),
382 ct.Cfg('kubernetes_calico_cni_ipam_source_hash', ct.String(),
383 default='md5=b22623eeea3b29ba8ec071d859ac7055'),
Artem Panchenko0594cd72017-06-12 13:25:26 +0300384 ct.Cfg('kubernetes_netchecker_enabled', ct.Boolean(),
385 help="", default=True),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300386 ct.Cfg('kubernetes_netchecker_agent_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200387 default='mirantis/k8s-netchecker-agent:v1.2.2'),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300388 ct.Cfg('kubernetes_netchecker_server_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200389 default='mirantis/k8s-netchecker-server:v1.2.2'),
Artem Panchenko501e67e2017-06-14 14:59:18 +0300390 ct.Cfg('kubernetes_calico_policy_enabled', ct.Boolean(),
391 help="", default=False),
Artem Panchenko501e67e2017-06-14 14:59:18 +0300392 ct.Cfg('kubernetes_helm_enabled', ct.Boolean(),
Tatyana Leontovich038dc7d2017-09-22 16:25:59 +0300393 help="", default=False),
Victor Ryzhenkin0bf0bb02017-07-06 18:57:05 +0400394 ct.Cfg('kubernetes_virtlet_enabled', ct.Boolean(),
Tatyana Leontovich038dc7d2017-09-22 16:25:59 +0300395 help="", default=False),
Victor Ryzhenkin0bf0bb02017-07-06 18:57:05 +0400396 ct.Cfg('kubernetes_virtlet_image', ct.String(),
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400397 help="", default='mirantis/virtlet:v1.4.1'),
Victor Ryzhenkin5902ae62018-09-11 20:34:54 +0400398 ct.Cfg('kubernetes_dns', ct.Boolean(),
399 help="", default=True),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400400 ct.Cfg('kubernetes_externaldns_enabled', ct.Boolean(),
401 help="", default=False),
402 ct.Cfg('kubernetes_externaldns_image', ct.String(),
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400403 help="", default='{}/mirantis/external-dns/external-dns:'
404 'v0.5.6-2'.format(settings.DOCKER_REGISTRY)),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400405 ct.Cfg('kubernetes_externaldns_provider', ct.String(),
406 help="", default='coredns'),
407 ct.Cfg('kubernetes_coredns_enabled', ct.Boolean(),
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400408 help="", default=True),
Vladimir Jigulina6b018b2018-07-18 15:19:01 +0400409 ct.Cfg('kubernetes_metallb_enabled', ct.Boolean(),
410 help="", default=False),
Vladimir Jigulin5775bbb2018-10-03 10:34:54 +0400411 ct.Cfg('kubernetes_ingressnginx_enabled', ct.Boolean(),
412 help="", default=False),
Victor Ryzhenkin2a5806e2017-12-18 20:23:53 +0400413 ct.Cfg('kubelet_fail_on_swap', ct.Boolean(),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400414 help="", default=False)
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300415]
416
417k8s_opts = [
Artem Panchenko0594cd72017-06-12 13:25:26 +0300418 ct.Cfg('k8s_installed', ct.Boolean(),
419 help="", default=False),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300420 ct.Cfg('kube_host', ct.IPAddress(),
421 help="", default='0.0.0.0'),
422 ct.Cfg('kube_apiserver_port', ct.Integer(),
423 help="", default=443),
vrovacheva9d08332017-06-22 20:01:59 +0400424 ct.Cfg("k8s_conformance_run", ct.Boolean(),
425 default=False),
Victor Ryzhenkin8ff3c3f2018-01-17 19:37:05 +0400426 ct.Cfg("run_extended_virtlet_conformance", ct.Boolean(),
427 default=False),
vrovacheva9d08332017-06-22 20:01:59 +0400428 ct.Cfg('k8s_conformance_image', ct.String(),
Dennis Dmitriev75776c52017-12-26 18:22:53 +0200429 default='docker-prod-virtual.docker.mirantis.net/mirantis/'
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400430 'kubernetes/k8s-conformance:v1.11.3-2'),
Vladimir Jigulin62bcf462018-05-28 18:17:01 +0400431 ct.Cfg('k8s_update_chain', ct.String(),
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400432 default='v1.9.8-4 v1.10.4-4 v1.11.3-2')
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300433]
434
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +0200435day1_cfg_config_opts = [
436 ct.Cfg('configure_steps_path', ct.String(),
437 help="Path to YAML with steps to config cfg01 node",
438 default=_default_configure_steps),
439 ct.Cfg('environment_template_dir', ct.String(),
440 help="Path to directory with Environment template and inventory",
441 default=_default_environment_template_dir),
442 ct.Cfg('templates_dir', ct.String(),
443 help="Path to directory with templates",
444 default=_default_templates_dir),
445 ct.Cfg('cluster_maas_config', ct.String(),
446 help="Path to maas class yaml file for cfg node",
447 default=_default_cluster_maas_config),
448 ct.Cfg('maas_machines_macs', ct.JSONDict(),
449 help="""MAC of machines interfaces for maas config:
450 'parameters': {
451 'maas' : {
452 'region' : {
453 'machines': {
454 'ctl01': {
455 'interface': {
456 'mac': 'aa:bb:cc:dd:ee:ff'
457 }
458 }
459 '...': {
460 'interface': {
461 'mac': 'aa:bb:cc:dd:ee:ff'
462 }
463 }
464 }}}}""", default={}),
465]
466
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300467_group_opts = [
468 ('hardware', hardware_opts),
469 ('underlay', underlay_opts),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200470 ('salt_deploy', salt_deploy_opts),
471 ('salt', salt_opts),
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300472 ('core_deploy', core_deploy_opts),
473 ('core', core_opts),
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300474 ('oss_deploy', oss_deploy_opts),
475 ('oss', oss_opts),
sgudzb67ce732018-02-13 17:58:31 +0200476 ('drivetrain_deploy', drivetrain_deploy_opts),
477 ('drivetrain', drivetrain_opts),
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300478 ('decapod_deploy', decapod_deploy_opts),
479 ('decapod', decapod_opts),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200480 ('openstack_deploy', openstack_deploy_opts),
481 ('openstack', openstack_opts),
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200482 ('opencontrail', opencontrail_opts),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300483 ('stack_light', sl_opts),
484 ('sl_deploy', sl_deploy_opts),
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200485 ('ceph', ceph_opts),
486 ('ceph_deploy', ceph_deploy_opts),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300487 ('k8s_deploy', k8s_deploy_opts),
488 ('k8s', k8s_opts),
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +0200489 ('day1_cfg_config', day1_cfg_config_opts),
490 ('day1_underlay', underlay_opts),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300491]
492
493
494def register_opts(config):
495 config.register_group(cfg.OptGroup(name='hardware',
496 title="Hardware settings", help=""))
497 config.register_opts(group='hardware', opts=hardware_opts)
498
499 config.register_group(cfg.OptGroup(name='underlay',
500 title="Underlay configuration", help=""))
501 config.register_opts(group='underlay', opts=underlay_opts)
502
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200503 config.register_group(cfg.OptGroup(name='salt_deploy',
504 title="salt deploy configuration", help=""))
505 config.register_opts(group='salt_deploy', opts=salt_deploy_opts)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300506
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200507 config.register_group(cfg.OptGroup(name='salt',
508 title="salt config and credentials", help=""))
509 config.register_opts(group='salt', opts=salt_opts)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300510
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300511 config.register_group(cfg.OptGroup(name='core',
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200512 title="Common services for Openstack", help=""))
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300513 config.register_opts(group='core', opts=core_opts)
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200514
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300515 config.register_group(
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300516 cfg.OptGroup(name='core_deploy',
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200517 title="Common services for Openstack deploy config",
518 help=""))
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300519 config.register_opts(group='core_deploy',
520 opts=core_deploy_opts)
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200521
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300522 config.register_group(cfg.OptGroup(name='oss',
523 title="Operational Support System Tools", help=""))
524 config.register_opts(group='oss', opts=oss_opts)
525
526 config.register_group(cfg.OptGroup(name='oss_deploy',
527 title="OSS deploy config", help=""))
528 config.register_opts(group='oss_deploy',
529 opts=oss_deploy_opts)
530
sgudzb67ce732018-02-13 17:58:31 +0200531 config.register_group(cfg.OptGroup(name='drivetrain',
532 title="Drivetrain Tools", help=""))
533 config.register_opts(group='drivetrain', opts=drivetrain_opts)
534
535 config.register_group(cfg.OptGroup(name='drivetrain_deploy',
536 title="Drivetrain deploy config", help=""))
537 config.register_opts(group='drivetrain_deploy',
538 opts=drivetrain_deploy_opts)
539
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300540 config.register_group(cfg.OptGroup(name='decapod',
541 title="Decapod options for Ceph", help=""))
542 config.register_opts(group='decapod', opts=decapod_opts)
543
544 config.register_group(cfg.OptGroup(name='decapod_deploy',
545 title="Decapod deploy config", help=""))
546 config.register_opts(group='decapod_deploy',
547 opts=decapod_deploy_opts)
548
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200549 config.register_group(cfg.OptGroup(name='openstack',
550 title="Openstack config and credentials", help=""))
551 config.register_opts(group='openstack', opts=openstack_opts)
552
553 config.register_group(
554 cfg.OptGroup(name='openstack_deploy',
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300555 title="Openstack deploy config and credentials",
556 help=""))
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200557 config.register_opts(group='openstack_deploy', opts=openstack_deploy_opts)
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200558
559 config.register_group(cfg.OptGroup(name='opencontrail',
560 title="Options for Juniper contrail-tests", help=""))
561 config.register_opts(group='opencontrail', opts=opencontrail_opts)
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +0300562 config.register_group(
563 cfg.OptGroup(name='stack_light',
564 title="StackLight config and credentials", help=""))
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300565 config.register_opts(group='stack_light', opts=sl_opts)
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300566 config.register_group(
567 cfg.OptGroup(name='sl_deploy',
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300568 title="SL deploy config and credentials",
569 help=""))
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300570 config.register_opts(group='sl_deploy', opts=sl_deploy_opts)
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300571
572 config.register_group(cfg.OptGroup(name='k8s_deploy',
573 title="K8s deploy configuration"))
574 config.register_opts(group='k8s_deploy', opts=k8s_deploy_opts)
575
576 config.register_group(cfg.OptGroup(name='k8s',
577 title="K8s config and credentials"))
578 config.register_opts(group='k8s', opts=k8s_opts)
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200579 config.register_group(cfg.OptGroup(name='ceph',
580 title="ceph config", help=""))
581 config.register_opts(group='ceph', opts=ceph_opts)
582
583 config.register_group(
584 cfg.OptGroup(name='ceph_deploy',
585 title="Ceph deploy config ",
586 help=""))
587 config.register_opts(group='ceph_deploy', opts=ceph_deploy_opts)
588
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +0200589 config.register_group(cfg.OptGroup(name='day1_cfg_config',
590 title="Day01 config node configuration", help=""))
591 config.register_opts(group='day1_cfg_config', opts=day1_cfg_config_opts)
592
593 config.register_group(cfg.OptGroup(name='day1_underlay',
594 title="Day01 underlay configuration", help=""))
595 config.register_opts(group='day1_underlay', opts=underlay_opts)
596
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300597 return config
598
599
600def load_config(config_files):
601 config = cfg.CONF
602 register_opts(config)
603 config(args=[], default_config_files=config_files)
604 return config
605
606
607def reload_snapshot_config(config, test_config_path):
608 """Reset config to the state from test_config file"""
609 config(args=[], default_config_files=[test_config_path])
610 return config
611
612
613def list_opts():
614 """Return a list of oslo.config options available in the tcp_tests.
615 """
616 return [(group, copy.deepcopy(opts)) for group, opts in _group_opts]
617
618
619def list_current_opts(config):
620 """Return a list of oslo.config options available in the tcp_tests.
621 """
622 result_opts = []
623 for group, opts in _group_opts:
624 current_opts = copy.deepcopy(opts)
625 for opt in current_opts:
626 if hasattr(config, group):
627 if hasattr(config[group], opt.name):
628 opt.default = getattr(config[group], opt.name)
629 result_opts.append((group, current_opts))
630 return result_opts
631
632
633def save_config(config, snapshot_name, env_name=None):
634 if env_name is None:
635 env_name = 'config'
636 test_config_path = os.path.join(
637 settings.LOGS_DIR, '{0}_{1}.ini'.format(env_name, snapshot_name))
638
639 with open(test_config_path, 'w') as output_file:
640 formatter = generator._OptFormatter(output_file=output_file)
641 for group, opts in list_current_opts(config):
642 formatter.format_group(group)
643 for opt in opts:
644 formatter.format(opt, group, minimal=True)
645 formatter.write('\n')
646 formatter.write('\n')