From 9e776d94377a1bd962e93f5a2b2df90c4707e293 Mon Sep 17 00:00:00 2001 From: Sergey Kraynev Date: Thu, 19 Mar 2015 11:34:32 -0400 Subject: [PATCH] Use outputs section for getting ip addresses Instead of direct call in test we may also test attributes and show good example of how to use get_attr functions. Change-Id: I4c2e78fe6c1fc8808f0180592b60c091613a3af9 --- .../templates/test_neutron_loadbalancer.yaml | 13 +++++++++-- .../scenario/test_neutron_loadbalancer.py | 22 +++++-------------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/heat_integrationtests/scenario/templates/test_neutron_loadbalancer.yaml b/heat_integrationtests/scenario/templates/test_neutron_loadbalancer.yaml index fad7db88b8..a7e9f9c984 100644 --- a/heat_integrationtests/scenario/templates/test_neutron_loadbalancer.yaml +++ b/heat_integrationtests/scenario/templates/test_neutron_loadbalancer.yaml @@ -32,7 +32,7 @@ resources: - remote_ip_prefix: 0.0.0.0/0 protocol: icmp - server1 : + server1: type: OS::Nova::Server properties: name: Server1 @@ -52,7 +52,7 @@ resources: - 'python -m SimpleHTTPServer ' - { get_param: port } - server2 : + server2: type: OS::Nova::Server properties: name: Server2 @@ -106,3 +106,12 @@ resources: members: - { get_resource: server1 } +outputs: + serv1_ip: + value: {get_attr: [server1, networks, private, 0]} + serv2_ip: + value: {get_attr: [server2, networks, private, 0]} + vip: + value: {get_attr: [test_pool, vip, address]} + fip: + value: {get_attr: [floating_ip, floating_ip_address]} diff --git a/heat_integrationtests/scenario/test_neutron_loadbalancer.py b/heat_integrationtests/scenario/test_neutron_loadbalancer.py index bc2d77c619..3f4925194e 100644 --- a/heat_integrationtests/scenario/test_neutron_loadbalancer.py +++ b/heat_integrationtests/scenario/test_neutron_loadbalancer.py @@ -64,23 +64,11 @@ class NeutronLoadBalancerTest(scenario_base.ScenarioTestsBase): parameters=parameters ) - server1_id = self.client.resources.get( - sid, 'server1').physical_resource_id - server2_id = self.client.resources.get( - sid, 'server2').physical_resource_id - floating_ip_id = self.client.resources.get( - sid, 'floating_ip').physical_resource_id - floating_ip = self.network_client.show_floatingip( - floating_ip_id)['floatingip']['floating_ip_address'] - pool_id = self.client.resources.get( - sid, 'test_pool').physical_resource_id - vip_id = self.network_client.show_pool(pool_id)['pool']['vip_id'] - - vip = self.network_client.show_vip(vip_id)['vip']['address'] - server1_ip = self.compute_client.servers.get( - server1_id).networks['private'][0] - server2_ip = self.compute_client.servers.get( - server2_id).networks['private'][0] + stack = self.client.stacks.get(sid) + floating_ip = self._stack_output(stack, 'fip') + vip = self._stack_output(stack, 'vip') + server1_ip = self._stack_output(stack, 'serv1_ip') + server2_ip = self._stack_output(stack, 'serv2_ip') # Check connection and info about received responces self.check_connectivity(server1_ip)