Merge "Wait for the policy to be done in tests"
diff --git a/common/clients.py b/common/clients.py
index 58e0fce..48db671 100644
--- a/common/clients.py
+++ b/common/clients.py
@@ -71,11 +71,13 @@
self.conf = conf
self.admin_credentials = admin_credentials
- if self.conf.auth_url.find('/v'):
- self.auth_version = self.conf.auth_url.split('/v')[1]
- else:
- raise ValueError(_('Incorrectly specified auth_url config: no '
- 'version found.'))
+ self.auth_version = self.conf.auth_version
+ if not self.auth_version:
+ try:
+ self.auth_version = self.conf.auth_url.split('/v')[1]
+ except IndexError:
+ raise ValueError(_('Please specify version in auth_url or '
+ 'auth_version in config.'))
self.insecure = self.conf.disable_ssl_certificate_validation
self.ca_file = self.conf.ca_file
@@ -97,10 +99,10 @@
return self.conf.admin_password
return self.conf.password
- def _tenant_name(self):
+ def _project_name(self):
if self.admin_credentials:
- return self.conf.admin_tenant_name
- return self.conf.tenant_name
+ return self.conf.admin_project_name
+ return self.conf.project_name
def _get_orchestration_client(self):
endpoint = os.environ.get('HEAT_URL')
@@ -130,7 +132,7 @@
kwargs = {
'username': self._username(),
'password': self._password(),
- 'tenant_name': self._tenant_name(),
+ 'project_name': self._project_name(),
'auth_url': self.conf.auth_url
}
# keystone v2 can't ignore domain details
diff --git a/common/config.py b/common/config.py
index 2236a0c..d7126c4 100644
--- a/common/config.py
+++ b/common/config.py
@@ -40,13 +40,19 @@
cfg.StrOpt('admin_password',
help="Admin API key to use when authentication.",
secret=True),
- cfg.StrOpt('tenant_name',
- help="Tenant name to use for API requests."),
- cfg.StrOpt('admin_tenant_name',
+ cfg.StrOpt('project_name',
+ help="Project name to use for API requests.",
+ deprecated_opts=[cfg.DeprecatedOpt('tenant_name',
+ group='heat_plugin')]),
+ cfg.StrOpt('admin_project_name',
default='admin',
- help="Admin tenant name to use for admin API requests."),
+ help="Admin project name to use for admin API requests.",
+ deprecated_opts=[cfg.DeprecatedOpt('admin_tenant_name',
+ group='heat_plugin')]),
cfg.StrOpt('auth_url',
- help="Full URI of the OpenStack Identity API (Keystone)"),
+ help="Full URI of the OpenStack Identity API (Keystone)."),
+ cfg.StrOpt('auth_version',
+ help="OpenStack Identity API version."),
cfg.StrOpt('user_domain_name',
help="User domain name, if keystone v3 auth_url "
"is used"),
diff --git a/functional/test_create_update_neutron_subnet.py b/functional/test_create_update_neutron_subnet.py
index b745619..31ad6f5 100644
--- a/functional/test_create_update_neutron_subnet.py
+++ b/functional/test_create_update_neutron_subnet.py
@@ -33,26 +33,6 @@
value: {get_attr: [subnet, gateway_ip]}
'''
-test_template_with_translation = '''
-heat_template_version: 2016-10-14
-description: Test template to create/update subnet with translation
-parameters:
- net_cidr:
- type: string
-resources:
- net:
- type: OS::Neutron::Net
- net_value:
- type: OS::Heat::Value
- properties:
- value: {get_resource: net}
- subnet:
- type: OS::Neutron::Subnet
- properties:
- network: { get_attr: [net_value, value] }
- cidr: {get_param: net_cidr}
-'''
-
class UpdateSubnetTest(functional_base.FunctionalTestsBase):
@@ -145,14 +125,3 @@
new_gw_ip = self.get_outputs(stack_identifier, 'gateway_ip')
# new gateway_ip should be None
self.assertIsNone(new_gw_ip)
-
- def test_update_with_network_translation(self):
- # Just create and update where network is translated properly.
- env = {'parameters': {'net_cidr': '11.11.11.0/24'}}
- stack_identifier = self.stack_create(
- template=test_template_with_translation,
- environment=env)
- env = {'parameters': {'net_cidr': '11.11.12.0/24'}}
- self.update_stack(stack_identifier,
- template=test_template_with_translation,
- environment=env)
diff --git a/functional/test_event_sinks.py b/functional/test_event_sinks.py
index ea66b7d..5d9f566 100644
--- a/functional/test_event_sinks.py
+++ b/functional/test_event_sinks.py
@@ -42,7 +42,7 @@
'options': {
'os_username': self.conf.username,
'os_password': self.conf.password,
- 'os_project_name': self.conf.tenant_name,
+ 'os_project_name': self.conf.project_name,
'os_auth_url': self.conf.auth_url,
'os_user_domain_id': self.conf.user_domain_id,
'os_project_domain_id': self.conf.project_domain_id,
diff --git a/functional/test_translation.py b/functional/test_translation.py
new file mode 100644
index 0000000..ff20ab5
--- /dev/null
+++ b/functional/test_translation.py
@@ -0,0 +1,117 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from heat_integrationtests.functional import functional_base
+
+template_subnet_old_network = """
+heat_template_version: 2016-10-14
+parameters:
+ net_cidr:
+ type: string
+resources:
+ net:
+ type: OS::Neutron::Net
+ subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ cidr: { get_param: net_cidr }
+ network_id: { get_resource: net }
+"""
+
+template_with_get_attr = """
+heat_template_version: 2016-10-14
+description: Test template to create/update subnet with translation
+parameters:
+ net_cidr:
+ type: string
+resources:
+ net:
+ type: OS::Neutron::Net
+ net_value:
+ type: OS::Heat::Value
+ properties:
+ value: { get_resource: net }
+ subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ network: { get_attr: [net_value, value] }
+ cidr: { get_param: net_cidr }
+"""
+
+template_value_from_nested_stack_main = """
+heat_template_version: 2016-10-14
+parameters:
+ flavor:
+ type: string
+ image:
+ type: string
+ public_net:
+ type: string
+resources:
+ network_settings:
+ type: network.yaml
+ properties:
+ public_net: { get_param: public_net }
+ server:
+ type: OS::Nova::Server
+ properties:
+ flavor: { get_param: flavor }
+ image: { get_param: image }
+ networks: { get_attr: [network_settings, networks] }
+"""
+
+template_value_from_nested_stack_network = """
+heat_template_version: 2016-10-14
+parameters:
+ public_net:
+ type: string
+outputs:
+ networks:
+ value:
+ - uuid: { get_param: public_net }
+"""
+
+
+class TestTranslation(functional_base.FunctionalTestsBase):
+
+ def test_create_update_subnet_old_network(self):
+ # Just create and update where network is translated properly.
+ env = {'parameters': {'net_cidr': '11.11.11.0/24'}}
+ stack_identifier = self.stack_create(
+ template=template_subnet_old_network,
+ environment=env)
+ env = {'parameters': {'net_cidr': '11.11.12.0/24'}}
+ self.update_stack(stack_identifier,
+ template=template_subnet_old_network,
+ environment=env)
+
+ def test_create_update_translation_with_get_attr(self):
+ # Check create and update successful for translation function value.
+ env = {'parameters': {'net_cidr': '11.11.11.0/24'}}
+ stack_identifier = self.stack_create(
+ template=template_with_get_attr,
+ environment=env)
+ env = {'parameters': {'net_cidr': '11.11.12.0/24'}}
+ self.update_stack(stack_identifier,
+ template=template_with_get_attr,
+ environment=env)
+
+ def test_value_from_nested_stack(self):
+ env = {'parameters': {
+ 'flavor': self.conf.minimal_instance_type,
+ 'image': self.conf.minimal_image_ref,
+ 'public_net': self.conf.fixed_network_name
+ }}
+ self.stack_create(
+ template=template_value_from_nested_stack_main,
+ environment=env,
+ files={'network.yaml': template_value_from_nested_stack_network})