Resolve all functions before RESOLVE translation
As functions can be inside other functions, there is no
point in checking for specific functions that can be
template specific. Better to resolve all before
translating.
This also adds a functional test to avoid breaking this
in the future.
Change-Id: I5f72f7455384b3fd5650bd01e77e64bf485dd178
Partial-Bug: #1620859
diff --git a/functional/test_create_update_neutron_subnet.py b/functional/test_create_update_neutron_subnet.py
index 31ad6f5..b745619 100644
--- a/functional/test_create_update_neutron_subnet.py
+++ b/functional/test_create_update_neutron_subnet.py
@@ -33,6 +33,26 @@
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):
@@ -125,3 +145,14 @@
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)