blob: 9082301449de5012d8ed2eab5735bb6ea2aa1885 [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(),
Victor Ryzhenkin2687fa12018-05-24 16:28:17 +0400293 default='{}/mirantis/kubernetes/hyperkube-amd64:v1.8.13-11'.format(
294 settings.DOCKER_REGISTRY)),
295 ct.Cfg('kubernetes_pause_image', ct.String(),
296 default='{}/mirantis/kubernetes/pause-amd64:v1.8.13-11'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300297 settings.DOCKER_REGISTRY)),
298 ct.Cfg('kubernetes_calico_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200299 default='{}/mirantis/projectcalico/calico/node:v2.6.9'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300300 settings.DOCKER_REGISTRY)),
Victor Ryzhenkin53f1b492018-05-09 17:30:17 +0400301 ct.Cfg('kubernetes_calico_calicoctl_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200302 default='{}/mirantis/projectcalico/calico/ctl:v1.6.4'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300303 settings.DOCKER_REGISTRY)),
304 ct.Cfg('kubernetes_calico_cni_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200305 default='{}/mirantis/projectcalico/calico/cni:v1.11.5'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300306 settings.DOCKER_REGISTRY)),
Artem Panchenko0594cd72017-06-12 13:25:26 +0300307 ct.Cfg('kubernetes_netchecker_enabled', ct.Boolean(),
308 help="", default=True),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300309 ct.Cfg('kubernetes_netchecker_agent_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200310 default='mirantis/k8s-netchecker-agent:v1.2.2'),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300311 ct.Cfg('kubernetes_netchecker_server_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200312 default='mirantis/k8s-netchecker-server:v1.2.2'),
Artem Panchenko501e67e2017-06-14 14:59:18 +0300313 ct.Cfg('kubernetes_calico_policy_enabled', ct.Boolean(),
314 help="", default=False),
315 ct.Cfg('kubernetes_calico_policy_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200316 default='{}/mirantis/projectcalico/calico/kube-controllers:'
317 'v1.0.4'.format(settings.DOCKER_REGISTRY)),
Artem Panchenko501e67e2017-06-14 14:59:18 +0300318 ct.Cfg('kubernetes_helm_enabled', ct.Boolean(),
Tatyana Leontovich038dc7d2017-09-22 16:25:59 +0300319 help="", default=False),
Victor Ryzhenkin0bf0bb02017-07-06 18:57:05 +0400320 ct.Cfg('kubernetes_virtlet_enabled', ct.Boolean(),
Tatyana Leontovich038dc7d2017-09-22 16:25:59 +0300321 help="", default=False),
Victor Ryzhenkin0bf0bb02017-07-06 18:57:05 +0400322 ct.Cfg('kubernetes_virtlet_image', ct.String(),
Sergii Golovatiukc1b62f42017-10-06 13:24:32 +0200323 help="", default='mirantis/virtlet:v0.8.0'),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400324 ct.Cfg('kubernetes_externaldns_enabled', ct.Boolean(),
325 help="", default=False),
326 ct.Cfg('kubernetes_externaldns_image', ct.String(),
327 help="", default='mirantis/external-dns:latest'),
328 ct.Cfg('kubernetes_externaldns_provider', ct.String(),
329 help="", default='coredns'),
330 ct.Cfg('kubernetes_coredns_enabled', ct.Boolean(),
Victor Ryzhenkin2a5806e2017-12-18 20:23:53 +0400331 help="", default=False),
332 ct.Cfg('kubelet_fail_on_swap', ct.Boolean(),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400333 help="", default=False)
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300334]
335
336k8s_opts = [
Artem Panchenko0594cd72017-06-12 13:25:26 +0300337 ct.Cfg('k8s_installed', ct.Boolean(),
338 help="", default=False),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300339 ct.Cfg('kube_host', ct.IPAddress(),
340 help="", default='0.0.0.0'),
341 ct.Cfg('kube_apiserver_port', ct.Integer(),
342 help="", default=443),
vrovacheva9d08332017-06-22 20:01:59 +0400343 ct.Cfg("k8s_conformance_run", ct.Boolean(),
344 default=False),
Victor Ryzhenkin8ff3c3f2018-01-17 19:37:05 +0400345 ct.Cfg("run_extended_virtlet_conformance", ct.Boolean(),
346 default=False),
vrovacheva9d08332017-06-22 20:01:59 +0400347 ct.Cfg('k8s_conformance_image', ct.String(),
Dennis Dmitriev75776c52017-12-26 18:22:53 +0200348 default='docker-prod-virtual.docker.mirantis.net/mirantis/'
Victor Ryzhenkin2687fa12018-05-24 16:28:17 +0400349 'kubernetes/k8s-conformance:v1.8.13-11')
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300350]
351
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300352_group_opts = [
353 ('hardware', hardware_opts),
354 ('underlay', underlay_opts),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200355 ('salt_deploy', salt_deploy_opts),
356 ('salt', salt_opts),
357 ('common_services_deploy', common_services_deploy_opts),
358 ('common_services', common_services_opts),
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300359 ('oss_deploy', oss_deploy_opts),
360 ('oss', oss_opts),
sgudzb67ce732018-02-13 17:58:31 +0200361 ('drivetrain_deploy', drivetrain_deploy_opts),
362 ('drivetrain', drivetrain_opts),
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300363 ('decapod_deploy', decapod_deploy_opts),
364 ('decapod', decapod_opts),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200365 ('openstack_deploy', openstack_deploy_opts),
366 ('openstack', openstack_opts),
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200367 ('opencontrail', opencontrail_opts),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300368 ('stack_light', sl_opts),
369 ('sl_deploy', sl_deploy_opts),
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200370 ('ceph', ceph_opts),
371 ('ceph_deploy', ceph_deploy_opts),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300372 ('k8s_deploy', k8s_deploy_opts),
373 ('k8s', k8s_opts),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300374]
375
376
377def register_opts(config):
378 config.register_group(cfg.OptGroup(name='hardware',
379 title="Hardware settings", help=""))
380 config.register_opts(group='hardware', opts=hardware_opts)
381
382 config.register_group(cfg.OptGroup(name='underlay',
383 title="Underlay configuration", help=""))
384 config.register_opts(group='underlay', opts=underlay_opts)
385
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200386 config.register_group(cfg.OptGroup(name='salt_deploy',
387 title="salt deploy configuration", help=""))
388 config.register_opts(group='salt_deploy', opts=salt_deploy_opts)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300389
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200390 config.register_group(cfg.OptGroup(name='salt',
391 title="salt config and credentials", help=""))
392 config.register_opts(group='salt', opts=salt_opts)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300393
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200394 config.register_group(cfg.OptGroup(name='common_services',
395 title="Common services for Openstack", help=""))
396 config.register_opts(group='common_services', opts=common_services_opts)
397
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300398 config.register_group(
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200399 cfg.OptGroup(name='common_services_deploy',
400 title="Common services for Openstack deploy config",
401 help=""))
402 config.register_opts(group='common_services_deploy',
403 opts=common_services_deploy_opts)
404
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300405 config.register_group(cfg.OptGroup(name='oss',
406 title="Operational Support System Tools", help=""))
407 config.register_opts(group='oss', opts=oss_opts)
408
409 config.register_group(cfg.OptGroup(name='oss_deploy',
410 title="OSS deploy config", help=""))
411 config.register_opts(group='oss_deploy',
412 opts=oss_deploy_opts)
413
sgudzb67ce732018-02-13 17:58:31 +0200414 config.register_group(cfg.OptGroup(name='drivetrain',
415 title="Drivetrain Tools", help=""))
416 config.register_opts(group='drivetrain', opts=drivetrain_opts)
417
418 config.register_group(cfg.OptGroup(name='drivetrain_deploy',
419 title="Drivetrain deploy config", help=""))
420 config.register_opts(group='drivetrain_deploy',
421 opts=drivetrain_deploy_opts)
422
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300423 config.register_group(cfg.OptGroup(name='decapod',
424 title="Decapod options for Ceph", help=""))
425 config.register_opts(group='decapod', opts=decapod_opts)
426
427 config.register_group(cfg.OptGroup(name='decapod_deploy',
428 title="Decapod deploy config", help=""))
429 config.register_opts(group='decapod_deploy',
430 opts=decapod_deploy_opts)
431
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200432 config.register_group(cfg.OptGroup(name='openstack',
433 title="Openstack config and credentials", help=""))
434 config.register_opts(group='openstack', opts=openstack_opts)
435
436 config.register_group(
437 cfg.OptGroup(name='openstack_deploy',
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300438 title="Openstack deploy config and credentials",
439 help=""))
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200440 config.register_opts(group='openstack_deploy', opts=openstack_deploy_opts)
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200441
442 config.register_group(cfg.OptGroup(name='opencontrail',
443 title="Options for Juniper contrail-tests", help=""))
444 config.register_opts(group='opencontrail', opts=opencontrail_opts)
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +0300445 config.register_group(
446 cfg.OptGroup(name='stack_light',
447 title="StackLight config and credentials", help=""))
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300448 config.register_opts(group='stack_light', opts=sl_opts)
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300449 config.register_group(
450 cfg.OptGroup(name='sl_deploy',
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300451 title="SL deploy config and credentials",
452 help=""))
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300453 config.register_opts(group='sl_deploy', opts=sl_deploy_opts)
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300454
455 config.register_group(cfg.OptGroup(name='k8s_deploy',
456 title="K8s deploy configuration"))
457 config.register_opts(group='k8s_deploy', opts=k8s_deploy_opts)
458
459 config.register_group(cfg.OptGroup(name='k8s',
460 title="K8s config and credentials"))
461 config.register_opts(group='k8s', opts=k8s_opts)
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200462 config.register_group(cfg.OptGroup(name='ceph',
463 title="ceph config", help=""))
464 config.register_opts(group='ceph', opts=ceph_opts)
465
466 config.register_group(
467 cfg.OptGroup(name='ceph_deploy',
468 title="Ceph deploy config ",
469 help=""))
470 config.register_opts(group='ceph_deploy', opts=ceph_deploy_opts)
471
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300472 return config
473
474
475def load_config(config_files):
476 config = cfg.CONF
477 register_opts(config)
478 config(args=[], default_config_files=config_files)
479 return config
480
481
482def reload_snapshot_config(config, test_config_path):
483 """Reset config to the state from test_config file"""
484 config(args=[], default_config_files=[test_config_path])
485 return config
486
487
488def list_opts():
489 """Return a list of oslo.config options available in the tcp_tests.
490 """
491 return [(group, copy.deepcopy(opts)) for group, opts in _group_opts]
492
493
494def list_current_opts(config):
495 """Return a list of oslo.config options available in the tcp_tests.
496 """
497 result_opts = []
498 for group, opts in _group_opts:
499 current_opts = copy.deepcopy(opts)
500 for opt in current_opts:
501 if hasattr(config, group):
502 if hasattr(config[group], opt.name):
503 opt.default = getattr(config[group], opt.name)
504 result_opts.append((group, current_opts))
505 return result_opts
506
507
508def save_config(config, snapshot_name, env_name=None):
509 if env_name is None:
510 env_name = 'config'
511 test_config_path = os.path.join(
512 settings.LOGS_DIR, '{0}_{1}.ini'.format(env_name, snapshot_name))
513
514 with open(test_config_path, 'w') as output_file:
515 formatter = generator._OptFormatter(output_file=output_file)
516 for group, opts in list_current_opts(config):
517 formatter.format_group(group)
518 for opt in opts:
519 formatter.format(opt, group, minimal=True)
520 formatter.write('\n')
521 formatter.write('\n')