Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 1 | # 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. |
| 14 | import copy |
| 15 | import os |
| 16 | import pkg_resources |
| 17 | |
| 18 | from oslo_config import cfg |
| 19 | from oslo_config import generator |
| 20 | |
| 21 | from tcp_tests.helpers import ext |
| 22 | from tcp_tests.helpers import oslo_cfg_types as ct |
| 23 | from tcp_tests import settings |
| 24 | |
Dennis Dmitriev | 9b02c8b | 2017-11-13 15:31:35 +0200 | [diff] [blame] | 25 | print("\n" + "-" * 10 + " Initialize oslo.config variables with defaults" |
| 26 | " from environment" + "-" * 10) |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 27 | |
| 28 | _default_conf = pkg_resources.resource_filename( |
Dennis Dmitriev | ab83ea4 | 2017-05-12 16:52:45 +0300 | [diff] [blame] | 29 | __name__, 'templates/{0}/underlay.yaml'.format(settings.LAB_CONFIG_NAME)) |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 30 | |
| 31 | _default_salt_steps = pkg_resources.resource_filename( |
Dennis Dmitriev | ab83ea4 | 2017-05-12 16:52:45 +0300 | [diff] [blame] | 32 | __name__, 'templates/{0}/salt.yaml'.format(settings.LAB_CONFIG_NAME)) |
Dennis Dmitriev | 9dada8a | 2017-08-30 17:38:55 +0300 | [diff] [blame] | 33 | _default_environment_template_dir = pkg_resources.resource_filename( |
| 34 | __name__, 'environment/') |
Dmitry Tyzhnenko | 8f6a63e | 2017-09-05 15:37:23 +0300 | [diff] [blame] | 35 | _default_templates_dir = pkg_resources.resource_filename( |
| 36 | __name__, 'templates/') |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 37 | _default_common_services_steps = pkg_resources.resource_filename( |
| 38 | __name__, |
Dennis Dmitriev | ab83ea4 | 2017-05-12 16:52:45 +0300 | [diff] [blame] | 39 | 'templates/{0}/common-services.yaml'.format( |
Dennis Dmitriev | 2a13a13 | 2016-11-04 00:56:23 +0200 | [diff] [blame] | 40 | settings.LAB_CONFIG_NAME)) |
Dennis Dmitriev | eac3aab | 2017-07-12 16:36:41 +0300 | [diff] [blame] | 41 | _default_oss_steps = pkg_resources.resource_filename( |
| 42 | __name__, |
| 43 | 'templates/{0}/oss.yaml'.format( |
| 44 | settings.LAB_CONFIG_NAME)) |
Dennis Dmitriev | f3f90a5 | 2017-08-10 14:37:05 +0300 | [diff] [blame] | 45 | _default_decapod_steps = pkg_resources.resource_filename( |
| 46 | __name__, |
| 47 | 'templates/{0}/decapod.yaml'.format( |
| 48 | settings.LAB_CONFIG_NAME)) |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 49 | _default_openstack_steps = pkg_resources.resource_filename( |
Dennis Dmitriev | ab83ea4 | 2017-05-12 16:52:45 +0300 | [diff] [blame] | 50 | __name__, 'templates/{0}/openstack.yaml'.format( |
Dennis Dmitriev | 2a13a13 | 2016-11-04 00:56:23 +0200 | [diff] [blame] | 51 | settings.LAB_CONFIG_NAME)) |
Dina Belova | e6fdffb | 2017-09-19 13:58:34 -0700 | [diff] [blame] | 52 | _default_opencontrail_prepare_tests_steps_path = \ |
| 53 | pkg_resources.resource_filename( |
| 54 | __name__, 'templates/{0}/opencontrail.yaml'.format( |
| 55 | settings.LAB_CONFIG_NAME)) |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 56 | _default_sl_prepare_tests_steps_path = pkg_resources.resource_filename( |
| 57 | __name__, 'templates/{0}/sl.yaml'.format( |
| 58 | settings.LAB_CONFIG_NAME)) |
Tatyana Leontovich | 460f7df | 2017-11-13 15:45:06 +0200 | [diff] [blame] | 59 | _default_ceph_prepare_tests_steps_path = pkg_resources.resource_filename( |
| 60 | __name__, 'templates/{0}/ceph.yaml'.format( |
| 61 | settings.LAB_CONFIG_NAME)) |
Artem Panchenko | 0594cd7 | 2017-06-12 13:25:26 +0300 | [diff] [blame] | 62 | _default_k8s_steps = pkg_resources.resource_filename( |
| 63 | __name__, 'templates/{0}/k8s.yaml'.format( |
| 64 | settings.LAB_CONFIG_NAME)) |
Dmitry Tyzhnenko | b864183 | 2017-11-07 17:02:47 +0200 | [diff] [blame] | 65 | _default_net_mgm = os.environ.get("NET_MGMT", "admin-pool01") |
| 66 | |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 67 | |
| 68 | hardware_opts = [ |
| 69 | ct.Cfg('manager', ct.String(), |
| 70 | help="Hardware manager name", default="devops"), |
| 71 | ct.Cfg('conf_path', ct.String(), |
| 72 | help="Hardware config file", default=_default_conf), |
| 73 | ct.Cfg('current_snapshot', ct.String(), |
| 74 | help="Latest environment status name", |
| 75 | default=ext.SNAPSHOT.hardware), |
| 76 | ] |
| 77 | |
| 78 | |
| 79 | underlay_opts = [ |
| 80 | ct.Cfg('ssh', ct.JSONList(), |
| 81 | help="""SSH Settings for Underlay: [{ |
| 82 | 'node_name': node1, |
Dennis Dmitriev | 23e5d19 | 2016-10-31 11:27:10 +0200 | [diff] [blame] | 83 | 'roles': ['salt-master', 'salt-minion', ], |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 84 | 'host': hostname, |
| 85 | 'login': login, |
| 86 | 'password': password, |
| 87 | 'address_pool': (optional), |
| 88 | 'port': (optional), |
| 89 | 'keys': [(optional)], |
| 90 | }, ...]""", default=[]), |
| 91 | ct.Cfg('roles', ct.JSONList(), |
| 92 | help="Node roles managed by underlay in the environment", |
Dennis Dmitriev | 53d3b77 | 2016-10-18 14:31:58 +0300 | [diff] [blame] | 93 | default=[ext.UNDERLAY_NODE_ROLES.salt_master, |
vrovachev | 99228d3 | 2017-06-08 19:46:10 +0400 | [diff] [blame] | 94 | ext.UNDERLAY_NODE_ROLES.salt_minion, |
Victor Ryzhenkin | 66d3937 | 2017-09-28 19:25:48 +0400 | [diff] [blame] | 95 | ext.UNDERLAY_NODE_ROLES.k8s_controller]), |
Dennis Dmitriev | 7b9538f | 2017-05-15 17:01:34 +0300 | [diff] [blame] | 96 | ct.Cfg('bootstrap_timeout', ct.Integer(), |
| 97 | help="Timeout of waiting SSH for nodes with specified roles", |
| 98 | default=480), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 99 | ct.Cfg('nameservers', ct.JSONList(), |
| 100 | help="IP addresses of DNS servers", |
| 101 | default=[]), |
| 102 | ct.Cfg('upstream_dns_servers', ct.JSONList(), |
| 103 | help="IP addresses of upstream DNS servers (dnsmasq)", |
| 104 | default=[]), |
| 105 | ct.Cfg('lvm', ct.JSONDict(), |
| 106 | help="LVM settings for Underlay", default={}), |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 107 | ct.Cfg('address_pools', ct.JSONDict(), |
| 108 | help="""Address pools (dynamically) allocated for the environment. |
| 109 | May be used to determine CIDR for a specific network from |
| 110 | tests or during the deployment process. |
| 111 | {'pool_name1': '<cidr>', 'pool_name2': '<cidr>', ...}""", |
| 112 | default={}), |
Artem Panchenko | db0a97f | 2017-06-27 19:09:13 +0300 | [diff] [blame] | 113 | ct.Cfg('ssh_keys', ct.JSONList(), default=[], |
| 114 | help="SSH key pair(s) for root. If the option is left empty, " |
| 115 | "then a key pair will be generated automatically"), |
| 116 | ct.Cfg('ssh_key_file', ct.String(), default=os.path.abspath('./id_rsa'), |
| 117 | help='Path (local) to file with private key authorized on nodes'), |
Dmitry Tyzhnenko | b864183 | 2017-11-07 17:02:47 +0200 | [diff] [blame] | 118 | ct.Cfg('net_mgmt', ct.String(), default=_default_net_mgm) |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 119 | ] |
| 120 | |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 121 | |
| 122 | salt_deploy_opts = [ |
| 123 | ct.Cfg('salt_steps_path', ct.String(), |
| 124 | help="Path to YAML with steps to deploy salt", |
| 125 | default=_default_salt_steps), |
Dennis Dmitriev | 9dada8a | 2017-08-30 17:38:55 +0300 | [diff] [blame] | 126 | ct.Cfg('environment_template_dir', ct.String(), |
| 127 | help="Path to directory with Environment template and inventory", |
| 128 | default=_default_environment_template_dir), |
Dmitry Tyzhnenko | 8f6a63e | 2017-09-05 15:37:23 +0300 | [diff] [blame] | 129 | ct.Cfg('templates_dir', ct.String(), |
| 130 | help="Path to directory with templates", |
| 131 | default=_default_templates_dir), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 132 | ] |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 133 | salt_opts = [ |
| 134 | ct.Cfg('salt_master_host', ct.IPAddress(), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 135 | help="", default='0.0.0.0'), |
Dennis Dmitriev | 2d60c8e | 2017-05-12 18:34:01 +0300 | [diff] [blame] | 136 | ct.Cfg('salt_master_port', ct.String(), |
| 137 | help="", default='6969'), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 138 | ] |
| 139 | |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 140 | common_services_deploy_opts = [ |
| 141 | ct.Cfg('common_services_steps_path', ct.String(), |
| 142 | help="Path to YAML with steps to deploy common services", |
| 143 | default=_default_common_services_steps), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 144 | ] |
| 145 | |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 146 | common_services_opts = [ |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 147 | ct.Cfg('common_services_installed', ct.Boolean(), |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 148 | help="", default=False), |
| 149 | ] |
| 150 | |
Dennis Dmitriev | eac3aab | 2017-07-12 16:36:41 +0300 | [diff] [blame] | 151 | oss_deploy_opts = [ |
| 152 | ct.Cfg('oss_steps_path', ct.String(), |
| 153 | help="Path to YAML with steps to deploy OSS Tools", |
| 154 | default=_default_oss_steps), |
| 155 | ] |
| 156 | |
| 157 | oss_opts = [ |
| 158 | ct.Cfg('oss_installed', ct.Boolean(), |
| 159 | help="", default=False), |
| 160 | ] |
| 161 | |
Dennis Dmitriev | f3f90a5 | 2017-08-10 14:37:05 +0300 | [diff] [blame] | 162 | decapod_deploy_opts = [ |
| 163 | ct.Cfg('decapod_steps_path', ct.String(), |
| 164 | help="Path to YAML with steps to deploy Ceph with Decapod", |
| 165 | default=_default_decapod_steps), |
| 166 | ] |
| 167 | |
| 168 | decapod_opts = [ |
| 169 | ct.Cfg('decapod_installed', ct.Boolean(), |
| 170 | help="", default=False), |
| 171 | ] |
| 172 | |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 173 | openstack_deploy_opts = [ |
| 174 | ct.Cfg('openstack_steps_path', ct.String(), |
| 175 | help="Path to YAML with steps to deploy openstack", |
| 176 | default=_default_openstack_steps), |
| 177 | ] |
| 178 | openstack_opts = [ |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 179 | ct.Cfg('openstack_installed', ct.Boolean(), |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 180 | help="", default=False), |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 181 | ct.Cfg('openstack_keystone_endpoint', ct.String(), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 182 | help="", default=''), |
| 183 | ] |
| 184 | |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 185 | opencontrail_opts = [ |
| 186 | ct.Cfg('opencontrail_tags', ct.String(), |
| 187 | help="", default=''), |
| 188 | ct.Cfg('opencontrail_features', ct.String(), |
| 189 | help="", default=''), |
| 190 | ct.Cfg('opencontrail_prepare_tests_steps_path', ct.String(), |
| 191 | help="Path to YAML with steps to prepare contrail-tests", |
| 192 | default=_default_opencontrail_prepare_tests_steps_path), |
| 193 | ] |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 194 | |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 195 | sl_deploy_opts = [ |
| 196 | ct.Cfg('sl_steps_path', ct.String(), |
| 197 | help="Path to YAML with steps to deploy sl", |
| 198 | default=_default_sl_prepare_tests_steps_path), |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 199 | ct.Cfg('docker_image_alertmanager', ct.String(), |
| 200 | default='{}/openstack-docker/alertmanager:latest'.format( |
| 201 | settings.DOCKER_REGISTRY)), |
| 202 | ct.Cfg('docker_image_pushgateway', ct.String(), |
| 203 | default='{}/openstack-docker/pushgateway:latest'.format( |
| 204 | settings.DOCKER_REGISTRY)), |
| 205 | ct.Cfg('docker_image_prometheus', ct.String(), |
| 206 | default='{}/openstack-docker/prometheus:latest'.format( |
| 207 | settings.DOCKER_REGISTRY)), |
| 208 | ct.Cfg('docker_image_remote_agent', ct.String(), |
| 209 | default='{}/openstack-docker/telegraf:latest'.format( |
| 210 | settings.DOCKER_REGISTRY)), |
| 211 | ct.Cfg('docker_image_remote_storage_adapter', ct.String(), |
| 212 | default='{}/openstack-docker/remote_storage_adapter:latest'.format( |
| 213 | settings.DOCKER_REGISTRY)), |
Dennis Dmitriev | 86f63e8 | 2017-11-09 00:07:45 +0200 | [diff] [blame] | 214 | # SalesForce connection options for pushkin |
Dennis Dmitriev | ce5ed8b | 2017-11-09 00:44:19 +0200 | [diff] [blame] | 215 | ct.Cfg('sfdc_sandbox_enabled', ct.String(), default='False'), |
Dennis Dmitriev | 86f63e8 | 2017-11-09 00:07:45 +0200 | [diff] [blame] | 216 | ct.Cfg('sfdc_auth_url', ct.String(), default=''), |
| 217 | ct.Cfg('sfdc_username', ct.String(), default=''), |
| 218 | ct.Cfg('sfdc_password', ct.String(), default=''), |
| 219 | ct.Cfg('sfdc_consumer_key', ct.String(), default=''), |
| 220 | ct.Cfg('sfdc_consumer_secret', ct.String(), default=''), |
| 221 | ct.Cfg('sfdc_organization_id', ct.String(), default=''), |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 222 | ] |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 223 | |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 224 | sl_opts = [ |
| 225 | ct.Cfg('sl_installed', ct.Boolean(), |
| 226 | help="", default=False), |
sgudz | bf4de57 | 2017-11-23 14:37:01 +0200 | [diff] [blame] | 227 | ct.Cfg('sl_version', ct.String(), |
| 228 | help="StackLight version. Could be 1 or 2", default=''), |
Tatyana Leontovich | 09b7b01 | 2017-07-10 12:53:45 +0300 | [diff] [blame] | 229 | ct.Cfg('sl_vip_host', ct.IPAddress(), |
| 230 | help="Vip address for SL services", default='0.0.0.0'), |
| 231 | ct.Cfg('sl_prometheus_port', ct.String(), |
| 232 | help="Prometheus port", default='15010'), |
| 233 | ct.Cfg('sl_prometheus_proto', ct.String(), |
| 234 | help="Proemtheus protocol", default='http'), |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 235 | ] |
| 236 | |
Tatyana Leontovich | 460f7df | 2017-11-13 15:45:06 +0200 | [diff] [blame] | 237 | ceph_deploy_opts = [ |
| 238 | ct.Cfg('ceph_steps_path', ct.String(), |
| 239 | help="Path to YAML with steps to deploy sl", |
Tatyana Leontovich | a754ce5 | 2017-11-13 16:46:43 +0200 | [diff] [blame] | 240 | default=_default_ceph_prepare_tests_steps_path), |
Tatyana Leontovich | 460f7df | 2017-11-13 15:45:06 +0200 | [diff] [blame] | 241 | ] |
| 242 | |
| 243 | ceph_opts = [ |
Tatyana Leontovich | a754ce5 | 2017-11-13 16:46:43 +0200 | [diff] [blame] | 244 | ct.Cfg('ceph_installed', ct.Boolean(), |
Tatyana Leontovich | 460f7df | 2017-11-13 15:45:06 +0200 | [diff] [blame] | 245 | help="", default=False), |
Tatyana Leontovich | 460f7df | 2017-11-13 15:45:06 +0200 | [diff] [blame] | 246 | ] |
| 247 | |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 248 | k8s_deploy_opts = [ |
Artem Panchenko | 0594cd7 | 2017-06-12 13:25:26 +0300 | [diff] [blame] | 249 | ct.Cfg('k8s_steps_path', ct.String(), |
| 250 | help="Path to YAML with steps to deploy Kubernetes", |
| 251 | default=_default_k8s_steps), |
| 252 | ct.Cfg('kubernetes_admin_user', ct.String(), default='admin'), |
| 253 | ct.Cfg('kubernetes_admin_password', ct.String(), |
| 254 | default='sbPfel23ZigJF3Bm'), |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 255 | ct.Cfg('kubernetes_docker_package', ct.String(), default=''), |
| 256 | ct.Cfg('kubernetes_hyperkube_image', ct.String(), |
Tatyana Leontovich | 038dc7d | 2017-09-22 16:25:59 +0300 | [diff] [blame] | 257 | default='{}/mirantis/kubernetes/hyperkube-amd64:v1.7.5-2'.format( |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 258 | settings.DOCKER_REGISTRY)), |
| 259 | ct.Cfg('kubernetes_calico_image', ct.String(), |
| 260 | default='{}/mirantis/projectcalico/calico/node:latest'.format( |
| 261 | settings.DOCKER_REGISTRY)), |
| 262 | ct.Cfg('kubernetes_calicoctl_image', ct.String(), |
| 263 | default='{}/mirantis/projectcalico/calico/ctl:latest'.format( |
| 264 | settings.DOCKER_REGISTRY)), |
| 265 | ct.Cfg('kubernetes_calico_cni_image', ct.String(), |
| 266 | default='{}/mirantis/projectcalico/calico/cni:latest'.format( |
| 267 | settings.DOCKER_REGISTRY)), |
Artem Panchenko | 0594cd7 | 2017-06-12 13:25:26 +0300 | [diff] [blame] | 268 | ct.Cfg('kubernetes_netchecker_enabled', ct.Boolean(), |
| 269 | help="", default=True), |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 270 | ct.Cfg('kubernetes_netchecker_agent_image', ct.String(), |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 271 | default='mirantis/k8s-netchecker-agent:stable'), |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 272 | ct.Cfg('kubernetes_netchecker_server_image', ct.String(), |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 273 | default='mirantis/k8s-netchecker-server:stable'), |
Artem Panchenko | 501e67e | 2017-06-14 14:59:18 +0300 | [diff] [blame] | 274 | ct.Cfg('kubernetes_calico_policy_enabled', ct.Boolean(), |
| 275 | help="", default=False), |
| 276 | ct.Cfg('kubernetes_calico_policy_image', ct.String(), |
| 277 | default='calico/kube-policy-controller:v0.5.4'), |
| 278 | ct.Cfg('kubernetes_helm_enabled', ct.Boolean(), |
Tatyana Leontovich | 038dc7d | 2017-09-22 16:25:59 +0300 | [diff] [blame] | 279 | help="", default=False), |
Victor Ryzhenkin | 0bf0bb0 | 2017-07-06 18:57:05 +0400 | [diff] [blame] | 280 | ct.Cfg('kubernetes_virtlet_enabled', ct.Boolean(), |
Tatyana Leontovich | 038dc7d | 2017-09-22 16:25:59 +0300 | [diff] [blame] | 281 | help="", default=False), |
Victor Ryzhenkin | 0bf0bb0 | 2017-07-06 18:57:05 +0400 | [diff] [blame] | 282 | ct.Cfg('kubernetes_virtlet_image', ct.String(), |
Sergii Golovatiuk | c1b62f4 | 2017-10-06 13:24:32 +0200 | [diff] [blame] | 283 | help="", default='mirantis/virtlet:v0.8.0'), |
Victor Ryzhenkin | 14354ac | 2017-09-27 17:42:30 +0400 | [diff] [blame] | 284 | ct.Cfg('kubernetes_externaldns_enabled', ct.Boolean(), |
| 285 | help="", default=False), |
| 286 | ct.Cfg('kubernetes_externaldns_image', ct.String(), |
| 287 | help="", default='mirantis/external-dns:latest'), |
| 288 | ct.Cfg('kubernetes_externaldns_provider', ct.String(), |
| 289 | help="", default='coredns'), |
| 290 | ct.Cfg('kubernetes_coredns_enabled', ct.Boolean(), |
Victor Ryzhenkin | 2a5806e | 2017-12-18 20:23:53 +0400 | [diff] [blame] | 291 | help="", default=False), |
| 292 | ct.Cfg('kubelet_fail_on_swap', ct.Boolean(), |
Victor Ryzhenkin | 14354ac | 2017-09-27 17:42:30 +0400 | [diff] [blame] | 293 | help="", default=False) |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 294 | ] |
| 295 | |
| 296 | k8s_opts = [ |
Artem Panchenko | 0594cd7 | 2017-06-12 13:25:26 +0300 | [diff] [blame] | 297 | ct.Cfg('k8s_installed', ct.Boolean(), |
| 298 | help="", default=False), |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 299 | ct.Cfg('kube_host', ct.IPAddress(), |
| 300 | help="", default='0.0.0.0'), |
| 301 | ct.Cfg('kube_apiserver_port', ct.Integer(), |
| 302 | help="", default=443), |
vrovachev | a9d0833 | 2017-06-22 20:01:59 +0400 | [diff] [blame] | 303 | ct.Cfg("k8s_conformance_run", ct.Boolean(), |
| 304 | default=False), |
Victor Ryzhenkin | 8ff3c3f | 2018-01-17 19:37:05 +0400 | [diff] [blame] | 305 | ct.Cfg("run_extended_virtlet_conformance", ct.Boolean(), |
| 306 | default=False), |
vrovachev | a9d0833 | 2017-06-22 20:01:59 +0400 | [diff] [blame] | 307 | ct.Cfg('k8s_conformance_image', ct.String(), |
Dennis Dmitriev | 75776c5 | 2017-12-26 18:22:53 +0200 | [diff] [blame] | 308 | default='docker-prod-virtual.docker.mirantis.net/mirantis/' |
| 309 | 'kubernetes/k8s-conformance:v1.7.5-2') |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 310 | ] |
| 311 | |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 312 | _group_opts = [ |
| 313 | ('hardware', hardware_opts), |
| 314 | ('underlay', underlay_opts), |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 315 | ('salt_deploy', salt_deploy_opts), |
| 316 | ('salt', salt_opts), |
| 317 | ('common_services_deploy', common_services_deploy_opts), |
| 318 | ('common_services', common_services_opts), |
Dennis Dmitriev | eac3aab | 2017-07-12 16:36:41 +0300 | [diff] [blame] | 319 | ('oss_deploy', oss_deploy_opts), |
| 320 | ('oss', oss_opts), |
Dennis Dmitriev | f3f90a5 | 2017-08-10 14:37:05 +0300 | [diff] [blame] | 321 | ('decapod_deploy', decapod_deploy_opts), |
| 322 | ('decapod', decapod_opts), |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 323 | ('openstack_deploy', openstack_deploy_opts), |
| 324 | ('openstack', openstack_opts), |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 325 | ('opencontrail', opencontrail_opts), |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 326 | ('stack_light', sl_opts), |
| 327 | ('sl_deploy', sl_deploy_opts), |
Tatyana Leontovich | a754ce5 | 2017-11-13 16:46:43 +0200 | [diff] [blame] | 328 | ('ceph', ceph_opts), |
| 329 | ('ceph_deploy', ceph_deploy_opts), |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 330 | ('k8s_deploy', k8s_deploy_opts), |
| 331 | ('k8s', k8s_opts), |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 332 | ] |
| 333 | |
| 334 | |
| 335 | def register_opts(config): |
| 336 | config.register_group(cfg.OptGroup(name='hardware', |
| 337 | title="Hardware settings", help="")) |
| 338 | config.register_opts(group='hardware', opts=hardware_opts) |
| 339 | |
| 340 | config.register_group(cfg.OptGroup(name='underlay', |
| 341 | title="Underlay configuration", help="")) |
| 342 | config.register_opts(group='underlay', opts=underlay_opts) |
| 343 | |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 344 | config.register_group(cfg.OptGroup(name='salt_deploy', |
| 345 | title="salt deploy configuration", help="")) |
| 346 | config.register_opts(group='salt_deploy', opts=salt_deploy_opts) |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 347 | |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 348 | config.register_group(cfg.OptGroup(name='salt', |
| 349 | title="salt config and credentials", help="")) |
| 350 | config.register_opts(group='salt', opts=salt_opts) |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 351 | |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 352 | config.register_group(cfg.OptGroup(name='common_services', |
| 353 | title="Common services for Openstack", help="")) |
| 354 | config.register_opts(group='common_services', opts=common_services_opts) |
| 355 | |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 356 | config.register_group( |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 357 | cfg.OptGroup(name='common_services_deploy', |
| 358 | title="Common services for Openstack deploy config", |
| 359 | help="")) |
| 360 | config.register_opts(group='common_services_deploy', |
| 361 | opts=common_services_deploy_opts) |
| 362 | |
Dennis Dmitriev | eac3aab | 2017-07-12 16:36:41 +0300 | [diff] [blame] | 363 | config.register_group(cfg.OptGroup(name='oss', |
| 364 | title="Operational Support System Tools", help="")) |
| 365 | config.register_opts(group='oss', opts=oss_opts) |
| 366 | |
| 367 | config.register_group(cfg.OptGroup(name='oss_deploy', |
| 368 | title="OSS deploy config", help="")) |
| 369 | config.register_opts(group='oss_deploy', |
| 370 | opts=oss_deploy_opts) |
| 371 | |
Dennis Dmitriev | f3f90a5 | 2017-08-10 14:37:05 +0300 | [diff] [blame] | 372 | config.register_group(cfg.OptGroup(name='decapod', |
| 373 | title="Decapod options for Ceph", help="")) |
| 374 | config.register_opts(group='decapod', opts=decapod_opts) |
| 375 | |
| 376 | config.register_group(cfg.OptGroup(name='decapod_deploy', |
| 377 | title="Decapod deploy config", help="")) |
| 378 | config.register_opts(group='decapod_deploy', |
| 379 | opts=decapod_deploy_opts) |
| 380 | |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 381 | config.register_group(cfg.OptGroup(name='openstack', |
| 382 | title="Openstack config and credentials", help="")) |
| 383 | config.register_opts(group='openstack', opts=openstack_opts) |
| 384 | |
| 385 | config.register_group( |
| 386 | cfg.OptGroup(name='openstack_deploy', |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 387 | title="Openstack deploy config and credentials", |
| 388 | help="")) |
Dennis Dmitriev | 6860ba6 | 2016-11-01 21:43:46 +0200 | [diff] [blame] | 389 | config.register_opts(group='openstack_deploy', opts=openstack_deploy_opts) |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 390 | |
| 391 | config.register_group(cfg.OptGroup(name='opencontrail', |
| 392 | title="Options for Juniper contrail-tests", help="")) |
| 393 | config.register_opts(group='opencontrail', opts=opencontrail_opts) |
Dmitry Tyzhnenko | 8f6a63e | 2017-09-05 15:37:23 +0300 | [diff] [blame] | 394 | config.register_group( |
| 395 | cfg.OptGroup(name='stack_light', |
| 396 | title="StackLight config and credentials", help="")) |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 397 | config.register_opts(group='stack_light', opts=sl_opts) |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 398 | config.register_group( |
| 399 | cfg.OptGroup(name='sl_deploy', |
Dennis Dmitriev | f3f90a5 | 2017-08-10 14:37:05 +0300 | [diff] [blame] | 400 | title="SL deploy config and credentials", |
| 401 | help="")) |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 402 | config.register_opts(group='sl_deploy', opts=sl_deploy_opts) |
Artem Panchenko | edf70ef | 2017-06-13 09:14:34 +0300 | [diff] [blame] | 403 | |
| 404 | config.register_group(cfg.OptGroup(name='k8s_deploy', |
| 405 | title="K8s deploy configuration")) |
| 406 | config.register_opts(group='k8s_deploy', opts=k8s_deploy_opts) |
| 407 | |
| 408 | config.register_group(cfg.OptGroup(name='k8s', |
| 409 | title="K8s config and credentials")) |
| 410 | config.register_opts(group='k8s', opts=k8s_opts) |
Tatyana Leontovich | a754ce5 | 2017-11-13 16:46:43 +0200 | [diff] [blame] | 411 | config.register_group(cfg.OptGroup(name='ceph', |
| 412 | title="ceph config", help="")) |
| 413 | config.register_opts(group='ceph', opts=ceph_opts) |
| 414 | |
| 415 | config.register_group( |
| 416 | cfg.OptGroup(name='ceph_deploy', |
| 417 | title="Ceph deploy config ", |
| 418 | help="")) |
| 419 | config.register_opts(group='ceph_deploy', opts=ceph_deploy_opts) |
| 420 | |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 421 | return config |
| 422 | |
| 423 | |
| 424 | def load_config(config_files): |
| 425 | config = cfg.CONF |
| 426 | register_opts(config) |
| 427 | config(args=[], default_config_files=config_files) |
| 428 | return config |
| 429 | |
| 430 | |
| 431 | def reload_snapshot_config(config, test_config_path): |
| 432 | """Reset config to the state from test_config file""" |
| 433 | config(args=[], default_config_files=[test_config_path]) |
| 434 | return config |
| 435 | |
| 436 | |
| 437 | def list_opts(): |
| 438 | """Return a list of oslo.config options available in the tcp_tests. |
| 439 | """ |
| 440 | return [(group, copy.deepcopy(opts)) for group, opts in _group_opts] |
| 441 | |
| 442 | |
| 443 | def list_current_opts(config): |
| 444 | """Return a list of oslo.config options available in the tcp_tests. |
| 445 | """ |
| 446 | result_opts = [] |
| 447 | for group, opts in _group_opts: |
| 448 | current_opts = copy.deepcopy(opts) |
| 449 | for opt in current_opts: |
| 450 | if hasattr(config, group): |
| 451 | if hasattr(config[group], opt.name): |
| 452 | opt.default = getattr(config[group], opt.name) |
| 453 | result_opts.append((group, current_opts)) |
| 454 | return result_opts |
| 455 | |
| 456 | |
| 457 | def save_config(config, snapshot_name, env_name=None): |
| 458 | if env_name is None: |
| 459 | env_name = 'config' |
| 460 | test_config_path = os.path.join( |
| 461 | settings.LOGS_DIR, '{0}_{1}.ini'.format(env_name, snapshot_name)) |
| 462 | |
| 463 | with open(test_config_path, 'w') as output_file: |
| 464 | formatter = generator._OptFormatter(output_file=output_file) |
| 465 | for group, opts in list_current_opts(config): |
| 466 | formatter.format_group(group) |
| 467 | for opt in opts: |
| 468 | formatter.format(opt, group, minimal=True) |
| 469 | formatter.write('\n') |
| 470 | formatter.write('\n') |