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
This commit is contained in:
Sergey Kraynev 2015-03-19 11:34:32 -04:00
parent 073a9d3404
commit 9e776d9437
2 changed files with 16 additions and 19 deletions

View File

@ -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]}

View File

@ -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)