Fix tempest tests for Sahara

Fix getting network id in client tests

Related-bug: #1425835

Change-Id: I27d4746fd4225637cf0e808ca31399ec5019c508
This commit is contained in:
Sergey Reshetnyak 2015-03-09 11:50:35 +03:00
parent bcd1c76651
commit 1ffe2a7abe
1 changed files with 21 additions and 11 deletions

View File

@ -114,20 +114,30 @@ class BaseDataProcessingTest(manager.ScenarioTest):
@classmethod
def get_floating_ip_pool_id_for_neutron(cls):
for network in cls.networks_client.list_networks()['networks']:
if network['name'] == CONF.data_processing.floating_ip_pool:
return network['id']
raise exceptions.NotFound(
'Floating IP pool \'%s\' not found in pool list.'
% CONF.data_processing.floating_ip_pool)
net_id = cls._find_network_by_name(
CONF.data_processing.floating_ip_pool)
if not net_id:
raise exceptions.NotFound(
'Floating IP pool \'%s\' not found in pool list.'
% CONF.data_processing.floating_ip_pool)
return net_id
@classmethod
def get_private_network_id(cls):
for network in cls.networks_client.list_networks()['networks']:
if network['name'] == CONF.data_processing.private_network:
net_id = cls._find_network_by_name(
CONF.data_processing.private_network)
if not net_id:
raise exceptions.NotFound(
'Private network \'%s\' not found in network list.'
% CONF.data_processing.private_network)
return net_id
@classmethod
def _find_network_by_name(cls, network_name):
for network in cls.networks_client.list_networks():
if network['label'] == network_name:
return network['id']
raise exceptions.NotFound(
'Private network \'%s\' not found in network list.'
% CONF.data_processing.private_network)
return None
def create_node_group_template(self, name, **kwargs):