Use ipv4 address for connectivity in lb integration test
You can not specify subnet for a server creation. Therefore server nic would get ip adresses from all subnets. We should pick the ipv4 address to check connectivity. Also added change to NovaClientPlugin to provide ipv4 address. Change-Id: I2eb3bdb359aca0cfaebf0be98db79170c681a078 Closes-Bug: #1450293
This commit is contained in:
parent
d644ea964d
commit
add8d1bdc7
@ -25,6 +25,7 @@ from novaclient import exceptions
|
||||
from novaclient import shell as novashell
|
||||
from oslo_config import cfg
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import netutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from six.moves.urllib import parse as urlparse
|
||||
@ -416,7 +417,9 @@ echo -e '%s\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
|
||||
else:
|
||||
for n in server.networks:
|
||||
if len(server.networks[n]) > 0:
|
||||
return server.networks[n][0]
|
||||
for addr in server.networks[n]:
|
||||
if netutils.is_valid_ipv4(addr):
|
||||
return addr
|
||||
|
||||
def get_server(self, server):
|
||||
try:
|
||||
|
@ -178,6 +178,11 @@ class HeatIntegrationTest(testscenarios.WithScenarios,
|
||||
if subnet_info['subnet']['ip_version'] == ip_version:
|
||||
return subnet_id
|
||||
|
||||
def _get_server_ip_by_version(self, addresses, ip_version=4):
|
||||
for address in addresses:
|
||||
if address['version'] == ip_version:
|
||||
return address['addr']
|
||||
|
||||
@staticmethod
|
||||
def _stack_output(stack, output_key):
|
||||
"""Return a stack output value for a given key."""
|
||||
|
@ -119,10 +119,10 @@ resources:
|
||||
- { get_resource: server1 }
|
||||
|
||||
outputs:
|
||||
serv1_ip:
|
||||
value: {get_attr: [server1, networks, private, 0]}
|
||||
serv2_ip:
|
||||
value: {get_attr: [server2, networks, private, 0]}
|
||||
serv1_addresses:
|
||||
value: {get_attr: [server1, addresses, private]}
|
||||
serv2_addresses:
|
||||
value: {get_attr: [server2, addresses, private]}
|
||||
vip:
|
||||
value: {get_attr: [test_pool, vip, address]}
|
||||
fip:
|
||||
|
@ -69,9 +69,10 @@ class NeutronLoadBalancerTest(scenario_base.ScenarioTestsBase):
|
||||
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')
|
||||
|
||||
server1_ip = self._get_server_ip_by_version(
|
||||
self._stack_output(stack, 'serv1_addresses'))
|
||||
server2_ip = self._get_server_ip_by_version(
|
||||
self._stack_output(stack, 'serv2_addresses'))
|
||||
# Check connection and info about received responses
|
||||
self.check_connectivity(server1_ip)
|
||||
self.collect_responses(server1_ip, {'server1\n'})
|
||||
|
Loading…
Reference in New Issue
Block a user