Merge "Fallback to creds provider for fixed IP network if no network_for_ssh"

This commit is contained in:
Jenkins 2016-10-13 00:21:44 +00:00 committed by Gerrit Code Review
commit 52225ece39

View File

@ -622,9 +622,20 @@ class ScenarioTest(tempest.test.BaseTestCase):
# method is creating the floating IP there.
return self.create_floating_ip(server)['ip']
elif CONF.validation.connect_method == 'fixed':
addresses = server['addresses'][CONF.validation.network_for_ssh]
# Determine the network name to look for based on config or creds
# provider network resources.
if CONF.validation.network_for_ssh:
addresses = server['addresses'][
CONF.validation.network_for_ssh]
else:
creds_provider = self._get_credentials_provider()
net_creds = creds_provider.get_primary_creds()
network = getattr(net_creds, 'network', None)
addresses = (server['addresses'][network['name']]
if network else [])
for address in addresses:
if address['version'] == CONF.validation.ip_version_for_ssh:
if (address['version'] == CONF.validation.ip_version_for_ssh
and address['OS-EXT-IPS:type'] == 'fixed'):
return address['addr']
raise exceptions.ServerUnreachable(server_id=server['id'])
else: