blob: c6a42019eb705b5e94771a0eda41281cf24a82e4 [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 Dmitriev6860ba62016-11-01 21:43:46 +020037_default_common_services_steps = pkg_resources.resource_filename(
38 __name__,
Dennis Dmitrievab83ea42017-05-12 16:52:45 +030039 'templates/{0}/common-services.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))
Dmitry Tyzhnenkob8641832017-11-07 17:02:47 +020069_default_net_mgm = os.environ.get("NET_MGMT", "admin-pool01")
70
Dennis Dmitriev6f59add2016-10-18 13:45:27 +030071
72hardware_opts = [
73 ct.Cfg('manager', ct.String(),
74 help="Hardware manager name", default="devops"),
75 ct.Cfg('conf_path', ct.String(),
76 help="Hardware config file", default=_default_conf),
77 ct.Cfg('current_snapshot', ct.String(),
78 help="Latest environment status name",
79 default=ext.SNAPSHOT.hardware),
80]
81
82
83underlay_opts = [
84 ct.Cfg('ssh', ct.JSONList(),
85 help="""SSH Settings for Underlay: [{
86 'node_name': node1,
Dennis Dmitriev23e5d192016-10-31 11:27:10 +020087 'roles': ['salt-master', 'salt-minion', ],
Dennis Dmitriev6f59add2016-10-18 13:45:27 +030088 'host': hostname,
89 'login': login,
90 'password': password,
91 'address_pool': (optional),
92 'port': (optional),
93 'keys': [(optional)],
94 }, ...]""", default=[]),
95 ct.Cfg('roles', ct.JSONList(),
96 help="Node roles managed by underlay in the environment",
Dennis Dmitriev53d3b772016-10-18 14:31:58 +030097 default=[ext.UNDERLAY_NODE_ROLES.salt_master,
vrovachev99228d32017-06-08 19:46:10 +040098 ext.UNDERLAY_NODE_ROLES.salt_minion,
Victor Ryzhenkin66d39372017-09-28 19:25:48 +040099 ext.UNDERLAY_NODE_ROLES.k8s_controller]),
Dennis Dmitriev7b9538f2017-05-15 17:01:34 +0300100 ct.Cfg('bootstrap_timeout', ct.Integer(),
101 help="Timeout of waiting SSH for nodes with specified roles",
Dennis Dmitriev4558ee92018-01-31 08:14:08 -0400102 default=600),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300103 ct.Cfg('nameservers', ct.JSONList(),
104 help="IP addresses of DNS servers",
105 default=[]),
106 ct.Cfg('upstream_dns_servers', ct.JSONList(),
107 help="IP addresses of upstream DNS servers (dnsmasq)",
108 default=[]),
109 ct.Cfg('lvm', ct.JSONDict(),
110 help="LVM settings for Underlay", default={}),
Dennis Dmitriev99b26fe2017-04-26 12:34:44 +0300111 ct.Cfg('address_pools', ct.JSONDict(),
112 help="""Address pools (dynamically) allocated for the environment.
113 May be used to determine CIDR for a specific network from
114 tests or during the deployment process.
115 {'pool_name1': '<cidr>', 'pool_name2': '<cidr>', ...}""",
116 default={}),
Artem Panchenkodb0a97f2017-06-27 19:09:13 +0300117 ct.Cfg('ssh_keys', ct.JSONList(), default=[],
118 help="SSH key pair(s) for root. If the option is left empty, "
119 "then a key pair will be generated automatically"),
120 ct.Cfg('ssh_key_file', ct.String(), default=os.path.abspath('./id_rsa'),
121 help='Path (local) to file with private key authorized on nodes'),
Dmitry Tyzhnenkob8641832017-11-07 17:02:47 +0200122 ct.Cfg('net_mgmt', ct.String(), default=_default_net_mgm)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300123]
124
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200125
126salt_deploy_opts = [
127 ct.Cfg('salt_steps_path', ct.String(),
128 help="Path to YAML with steps to deploy salt",
129 default=_default_salt_steps),
Dennis Dmitriev9dada8a2017-08-30 17:38:55 +0300130 ct.Cfg('environment_template_dir', ct.String(),
131 help="Path to directory with Environment template and inventory",
132 default=_default_environment_template_dir),
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +0300133 ct.Cfg('templates_dir', ct.String(),
134 help="Path to directory with templates",
135 default=_default_templates_dir),
Dennis Dmitriev5bcbdc52018-03-23 18:05:10 +0200136 ct.Cfg('salt_roles', ct.JSONList(),
137 help="Node roles to install salt-minions and manage by salt",
138 default=[ext.UNDERLAY_NODE_ROLES.salt_master,
139 ext.UNDERLAY_NODE_ROLES.salt_minion,
140 ext.UNDERLAY_NODE_ROLES.k8s_controller]),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300141]
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200142salt_opts = [
143 ct.Cfg('salt_master_host', ct.IPAddress(),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300144 help="", default='0.0.0.0'),
Dennis Dmitriev2d60c8e2017-05-12 18:34:01 +0300145 ct.Cfg('salt_master_port', ct.String(),
146 help="", default='6969'),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300147]
148
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200149common_services_deploy_opts = [
150 ct.Cfg('common_services_steps_path', ct.String(),
151 help="Path to YAML with steps to deploy common services",
152 default=_default_common_services_steps),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300153]
154
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200155common_services_opts = [
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200156 ct.Cfg('common_services_installed', ct.Boolean(),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200157 help="", default=False),
158]
159
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300160oss_deploy_opts = [
161 ct.Cfg('oss_steps_path', ct.String(),
162 help="Path to YAML with steps to deploy OSS Tools",
163 default=_default_oss_steps),
164]
165
166oss_opts = [
167 ct.Cfg('oss_installed', ct.Boolean(),
168 help="", default=False),
169]
170
sgudzb67ce732018-02-13 17:58:31 +0200171drivetrain_deploy_opts = [
172 ct.Cfg('drivetrain_steps_path', ct.String(),
173 help="Path to YAML with steps to deploy Drivetrain",
174 default=_default_drivetrain_steps),
175]
176
177drivetrain_opts = [
178 ct.Cfg('drivetrain_installed', ct.Boolean(),
179 help="", default=False),
180]
181
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300182decapod_deploy_opts = [
183 ct.Cfg('decapod_steps_path', ct.String(),
184 help="Path to YAML with steps to deploy Ceph with Decapod",
185 default=_default_decapod_steps),
186]
187
188decapod_opts = [
189 ct.Cfg('decapod_installed', ct.Boolean(),
190 help="", default=False),
191]
192
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200193openstack_deploy_opts = [
194 ct.Cfg('openstack_steps_path', ct.String(),
195 help="Path to YAML with steps to deploy openstack",
196 default=_default_openstack_steps),
Tatyana Leontovichc72604d2018-01-04 17:58:00 +0200197 ct.Cfg('horizon_host', ct.IPAddress(),
198 help="", default='0.0.0.0'),
199 ct.Cfg('horizon_port', ct.String(),
200 help="", default='5000'),
201 ct.Cfg('horizon_user', ct.String(),
202 help="", default='admin'),
203 ct.Cfg('horizon_password', ct.String(),
204 help="", default='workshop'),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200205]
206openstack_opts = [
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200207 ct.Cfg('openstack_installed', ct.Boolean(),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200208 help="", default=False),
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200209 ct.Cfg('openstack_keystone_endpoint', ct.String(),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300210 help="", default=''),
Tatyana Leontovichc08a54b2018-04-19 02:21:25 +0300211 ct.Cfg('horizon_check', ct.Boolean(),
Tatyana Leontovich69700712018-04-23 12:26:57 +0300212 help="", default=False),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300213]
214
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200215opencontrail_opts = [
216 ct.Cfg('opencontrail_tags', ct.String(),
217 help="", default=''),
218 ct.Cfg('opencontrail_features', ct.String(),
219 help="", default=''),
220 ct.Cfg('opencontrail_prepare_tests_steps_path', ct.String(),
221 help="Path to YAML with steps to prepare contrail-tests",
222 default=_default_opencontrail_prepare_tests_steps_path),
223]
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300224
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300225sl_deploy_opts = [
226 ct.Cfg('sl_steps_path', ct.String(),
227 help="Path to YAML with steps to deploy sl",
228 default=_default_sl_prepare_tests_steps_path),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300229 ct.Cfg('docker_image_alertmanager', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200230 default='{0}/openstack-docker/alertmanager:{1}'.format(
231 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300232 ct.Cfg('docker_image_pushgateway', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200233 default='{0}/openstack-docker/pushgateway:{1}'.format(
234 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300235 ct.Cfg('docker_image_prometheus', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200236 default='{0}/openstack-docker/prometheus:{1}'.format(
237 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300238 ct.Cfg('docker_image_remote_agent', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200239 default='{0}/openstack-docker/telegraf:{1}'.format(
240 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300241 ct.Cfg('docker_image_remote_storage_adapter', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200242 default='{0}/openstack-docker/remote_storage_adapter:{1}'.format(
243 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
244 ct.Cfg('docker_image_prometheus_relay', ct.String(),
245 default='{0}/openstack-docker/prometheus_relay:{1}'.format(
246 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
247 ct.Cfg('docker_image_grafana', ct.String(),
248 default='{0}/mirantis/external/grafana:{1}'.format(
249 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Dennis Dmitriev86f63e82017-11-09 00:07:45 +0200250 # SalesForce connection options for pushkin
Dennis Dmitrievce5ed8b2017-11-09 00:44:19 +0200251 ct.Cfg('sfdc_sandbox_enabled', ct.String(), default='False'),
Dennis Dmitriev86f63e82017-11-09 00:07:45 +0200252 ct.Cfg('sfdc_auth_url', ct.String(), default=''),
253 ct.Cfg('sfdc_username', ct.String(), default=''),
254 ct.Cfg('sfdc_password', ct.String(), default=''),
255 ct.Cfg('sfdc_consumer_key', ct.String(), default=''),
256 ct.Cfg('sfdc_consumer_secret', ct.String(), default=''),
257 ct.Cfg('sfdc_organization_id', ct.String(), default=''),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300258]
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300259
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300260sl_opts = [
261 ct.Cfg('sl_installed', ct.Boolean(),
262 help="", default=False),
sgudzbf4de572017-11-23 14:37:01 +0200263 ct.Cfg('sl_version', ct.String(),
264 help="StackLight version. Could be 1 or 2", default=''),
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300265 ct.Cfg('sl_vip_host', ct.IPAddress(),
266 help="Vip address for SL services", default='0.0.0.0'),
267 ct.Cfg('sl_prometheus_port', ct.String(),
268 help="Prometheus port", default='15010'),
269 ct.Cfg('sl_prometheus_proto', ct.String(),
270 help="Proemtheus protocol", default='http'),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300271]
272
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200273ceph_deploy_opts = [
274 ct.Cfg('ceph_steps_path', ct.String(),
275 help="Path to YAML with steps to deploy sl",
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200276 default=_default_ceph_prepare_tests_steps_path),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200277]
278
279ceph_opts = [
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200280 ct.Cfg('ceph_installed', ct.Boolean(),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200281 help="", default=False),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200282]
283
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300284k8s_deploy_opts = [
Artem Panchenko0594cd72017-06-12 13:25:26 +0300285 ct.Cfg('k8s_steps_path', ct.String(),
286 help="Path to YAML with steps to deploy Kubernetes",
287 default=_default_k8s_steps),
288 ct.Cfg('kubernetes_admin_user', ct.String(), default='admin'),
289 ct.Cfg('kubernetes_admin_password', ct.String(),
290 default='sbPfel23ZigJF3Bm'),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300291 ct.Cfg('kubernetes_docker_package', ct.String(), default=''),
292 ct.Cfg('kubernetes_hyperkube_image', ct.String(),
Tatyana Leontovich3968c712018-04-12 12:53:18 +0300293 default='{}/mirantis/kubernetes/hyperkube-amd64:v1.8.11-9'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300294 settings.DOCKER_REGISTRY)),
295 ct.Cfg('kubernetes_calico_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200296 default='{}/mirantis/projectcalico/calico/node:v2.6.9'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300297 settings.DOCKER_REGISTRY)),
Victor Ryzhenkin53f1b492018-05-09 17:30:17 +0400298 ct.Cfg('kubernetes_calico_calicoctl_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200299 default='{}/mirantis/projectcalico/calico/ctl:v1.6.4'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300300 settings.DOCKER_REGISTRY)),
301 ct.Cfg('kubernetes_calico_cni_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200302 default='{}/mirantis/projectcalico/calico/cni:v1.11.5'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300303 settings.DOCKER_REGISTRY)),
Artem Panchenko0594cd72017-06-12 13:25:26 +0300304 ct.Cfg('kubernetes_netchecker_enabled', ct.Boolean(),
305 help="", default=True),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300306 ct.Cfg('kubernetes_netchecker_agent_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200307 default='mirantis/k8s-netchecker-agent:v1.2.2'),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300308 ct.Cfg('kubernetes_netchecker_server_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200309 default='mirantis/k8s-netchecker-server:v1.2.2'),
Artem Panchenko501e67e2017-06-14 14:59:18 +0300310 ct.Cfg('kubernetes_calico_policy_enabled', ct.Boolean(),
311 help="", default=False),
312 ct.Cfg('kubernetes_calico_policy_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200313 default='{}/mirantis/projectcalico/calico/kube-controllers:'
314 'v1.0.4'.format(settings.DOCKER_REGISTRY)),
Artem Panchenko501e67e2017-06-14 14:59:18 +0300315 ct.Cfg('kubernetes_helm_enabled', ct.Boolean(),
Tatyana Leontovich038dc7d2017-09-22 16:25:59 +0300316 help="", default=False),
Victor Ryzhenkin0bf0bb02017-07-06 18:57:05 +0400317 ct.Cfg('kubernetes_virtlet_enabled', ct.Boolean(),
Tatyana Leontovich038dc7d2017-09-22 16:25:59 +0300318 help="", default=False),
Victor Ryzhenkin0bf0bb02017-07-06 18:57:05 +0400319 ct.Cfg('kubernetes_virtlet_image', ct.String(),
Sergii Golovatiukc1b62f42017-10-06 13:24:32 +0200320 help="", default='mirantis/virtlet:v0.8.0'),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400321 ct.Cfg('kubernetes_externaldns_enabled', ct.Boolean(),
322 help="", default=False),
323 ct.Cfg('kubernetes_externaldns_image', ct.String(),
324 help="", default='mirantis/external-dns:latest'),
325 ct.Cfg('kubernetes_externaldns_provider', ct.String(),
326 help="", default='coredns'),
327 ct.Cfg('kubernetes_coredns_enabled', ct.Boolean(),
Victor Ryzhenkin2a5806e2017-12-18 20:23:53 +0400328 help="", default=False),
329 ct.Cfg('kubelet_fail_on_swap', ct.Boolean(),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400330 help="", default=False)
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300331]
332
333k8s_opts = [
Artem Panchenko0594cd72017-06-12 13:25:26 +0300334 ct.Cfg('k8s_installed', ct.Boolean(),
335 help="", default=False),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300336 ct.Cfg('kube_host', ct.IPAddress(),
337 help="", default='0.0.0.0'),
338 ct.Cfg('kube_apiserver_port', ct.Integer(),
339 help="", default=443),
vrovacheva9d08332017-06-22 20:01:59 +0400340 ct.Cfg("k8s_conformance_run", ct.Boolean(),
341 default=False),
Victor Ryzhenkin8ff3c3f2018-01-17 19:37:05 +0400342 ct.Cfg("run_extended_virtlet_conformance", ct.Boolean(),
343 default=False),
vrovacheva9d08332017-06-22 20:01:59 +0400344 ct.Cfg('k8s_conformance_image', ct.String(),
Dennis Dmitriev75776c52017-12-26 18:22:53 +0200345 default='docker-prod-virtual.docker.mirantis.net/mirantis/'
Tatyana Leontovich3968c712018-04-12 12:53:18 +0300346 'kubernetes/k8s-conformance:v1.8.11-9')
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300347]
348
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300349_group_opts = [
350 ('hardware', hardware_opts),
351 ('underlay', underlay_opts),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200352 ('salt_deploy', salt_deploy_opts),
353 ('salt', salt_opts),
354 ('common_services_deploy', common_services_deploy_opts),
355 ('common_services', common_services_opts),
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300356 ('oss_deploy', oss_deploy_opts),
357 ('oss', oss_opts),
sgudzb67ce732018-02-13 17:58:31 +0200358 ('drivetrain_deploy', drivetrain_deploy_opts),
359 ('drivetrain', drivetrain_opts),
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300360 ('decapod_deploy', decapod_deploy_opts),
361 ('decapod', decapod_opts),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200362 ('openstack_deploy', openstack_deploy_opts),
363 ('openstack', openstack_opts),
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200364 ('opencontrail', opencontrail_opts),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300365 ('stack_light', sl_opts),
366 ('sl_deploy', sl_deploy_opts),
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200367 ('ceph', ceph_opts),
368 ('ceph_deploy', ceph_deploy_opts),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300369 ('k8s_deploy', k8s_deploy_opts),
370 ('k8s', k8s_opts),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300371]
372
373
374def register_opts(config):
375 config.register_group(cfg.OptGroup(name='hardware',
376 title="Hardware settings", help=""))
377 config.register_opts(group='hardware', opts=hardware_opts)
378
379 config.register_group(cfg.OptGroup(name='underlay',
380 title="Underlay configuration", help=""))
381 config.register_opts(group='underlay', opts=underlay_opts)
382
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200383 config.register_group(cfg.OptGroup(name='salt_deploy',
384 title="salt deploy configuration", help=""))
385 config.register_opts(group='salt_deploy', opts=salt_deploy_opts)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300386
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200387 config.register_group(cfg.OptGroup(name='salt',
388 title="salt config and credentials", help=""))
389 config.register_opts(group='salt', opts=salt_opts)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300390
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200391 config.register_group(cfg.OptGroup(name='common_services',
392 title="Common services for Openstack", help=""))
393 config.register_opts(group='common_services', opts=common_services_opts)
394
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300395 config.register_group(
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200396 cfg.OptGroup(name='common_services_deploy',
397 title="Common services for Openstack deploy config",
398 help=""))
399 config.register_opts(group='common_services_deploy',
400 opts=common_services_deploy_opts)
401
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300402 config.register_group(cfg.OptGroup(name='oss',
403 title="Operational Support System Tools", help=""))
404 config.register_opts(group='oss', opts=oss_opts)
405
406 config.register_group(cfg.OptGroup(name='oss_deploy',
407 title="OSS deploy config", help=""))
408 config.register_opts(group='oss_deploy',
409 opts=oss_deploy_opts)
410
sgudzb67ce732018-02-13 17:58:31 +0200411 config.register_group(cfg.OptGroup(name='drivetrain',
412 title="Drivetrain Tools", help=""))
413 config.register_opts(group='drivetrain', opts=drivetrain_opts)
414
415 config.register_group(cfg.OptGroup(name='drivetrain_deploy',
416 title="Drivetrain deploy config", help=""))
417 config.register_opts(group='drivetrain_deploy',
418 opts=drivetrain_deploy_opts)
419
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300420 config.register_group(cfg.OptGroup(name='decapod',
421 title="Decapod options for Ceph", help=""))
422 config.register_opts(group='decapod', opts=decapod_opts)
423
424 config.register_group(cfg.OptGroup(name='decapod_deploy',
425 title="Decapod deploy config", help=""))
426 config.register_opts(group='decapod_deploy',
427 opts=decapod_deploy_opts)
428
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200429 config.register_group(cfg.OptGroup(name='openstack',
430 title="Openstack config and credentials", help=""))
431 config.register_opts(group='openstack', opts=openstack_opts)
432
433 config.register_group(
434 cfg.OptGroup(name='openstack_deploy',
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300435 title="Openstack deploy config and credentials",
436 help=""))
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200437 config.register_opts(group='openstack_deploy', opts=openstack_deploy_opts)
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200438
439 config.register_group(cfg.OptGroup(name='opencontrail',
440 title="Options for Juniper contrail-tests", help=""))
441 config.register_opts(group='opencontrail', opts=opencontrail_opts)
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +0300442 config.register_group(
443 cfg.OptGroup(name='stack_light',
444 title="StackLight config and credentials", help=""))
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300445 config.register_opts(group='stack_light', opts=sl_opts)
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300446 config.register_group(
447 cfg.OptGroup(name='sl_deploy',
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300448 title="SL deploy config and credentials",
449 help=""))
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300450 config.register_opts(group='sl_deploy', opts=sl_deploy_opts)
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300451
452 config.register_group(cfg.OptGroup(name='k8s_deploy',
453 title="K8s deploy configuration"))
454 config.register_opts(group='k8s_deploy', opts=k8s_deploy_opts)
455
456 config.register_group(cfg.OptGroup(name='k8s',
457 title="K8s config and credentials"))
458 config.register_opts(group='k8s', opts=k8s_opts)
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200459 config.register_group(cfg.OptGroup(name='ceph',
460 title="ceph config", help=""))
461 config.register_opts(group='ceph', opts=ceph_opts)
462
463 config.register_group(
464 cfg.OptGroup(name='ceph_deploy',
465 title="Ceph deploy config ",
466 help=""))
467 config.register_opts(group='ceph_deploy', opts=ceph_deploy_opts)
468
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300469 return config
470
471
472def load_config(config_files):
473 config = cfg.CONF
474 register_opts(config)
475 config(args=[], default_config_files=config_files)
476 return config
477
478
479def reload_snapshot_config(config, test_config_path):
480 """Reset config to the state from test_config file"""
481 config(args=[], default_config_files=[test_config_path])
482 return config
483
484
485def list_opts():
486 """Return a list of oslo.config options available in the tcp_tests.
487 """
488 return [(group, copy.deepcopy(opts)) for group, opts in _group_opts]
489
490
491def list_current_opts(config):
492 """Return a list of oslo.config options available in the tcp_tests.
493 """
494 result_opts = []
495 for group, opts in _group_opts:
496 current_opts = copy.deepcopy(opts)
497 for opt in current_opts:
498 if hasattr(config, group):
499 if hasattr(config[group], opt.name):
500 opt.default = getattr(config[group], opt.name)
501 result_opts.append((group, current_opts))
502 return result_opts
503
504
505def save_config(config, snapshot_name, env_name=None):
506 if env_name is None:
507 env_name = 'config'
508 test_config_path = os.path.join(
509 settings.LOGS_DIR, '{0}_{1}.ini'.format(env_name, snapshot_name))
510
511 with open(test_config_path, 'w') as output_file:
512 formatter = generator._OptFormatter(output_file=output_file)
513 for group, opts in list_current_opts(config):
514 formatter.format_group(group)
515 for opt in opts:
516 formatter.format(opt, group, minimal=True)
517 formatter.write('\n')
518 formatter.write('\n')