Refactor '_get_default_network' method in the integration tests

Refactored '_get_default_network' to get any network by its name,
othewise it was impossible to get 'public' net.

Change-Id: Ie691f99961a28e47f7437f3e52be9baf2984e839
This commit is contained in:
Anastasia Kuznetsova 2015-03-12 16:41:36 +04:00
parent ebdaaae518
commit c4fa6f5861
2 changed files with 8 additions and 3 deletions

View File

@ -147,10 +147,12 @@ class HeatIntegrationTest(testscenarios.WithScenarios,
def _stack_rand_name(cls):
return rand_name(cls.__name__)
def _get_default_network(self):
def _get_network(self, net_name=None):
if net_name is None:
net_name = self.conf.fixed_network_name
networks = self.network_client.list_networks()
for net in networks['networks']:
if net['name'] == self.conf.fixed_network_name:
if net['name'] == net_name:
return net
@staticmethod

View File

@ -21,7 +21,10 @@ class ScenarioTestsBase(test.HeatIntegrationTest):
self.client = self.orchestration_client
self.sub_dir = 'templates'
self.assign_keypair()
self.net = self._get_default_network()
if not self.conf.fixed_network_name:
raise self.skipException("No default network configured to test")
self.net = self._get_network()
if not self.conf.image_ref:
raise self.skipException("No image configured to test")