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
diff --git a/common/test.py b/common/test.py
index 8c2a0d2..0ffa2b0 100644
--- a/common/test.py
+++ b/common/test.py
@@ -147,10 +147,12 @@
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
diff --git a/scenario/scenario_base.py b/scenario/scenario_base.py
index b08766a..77c3624 100644
--- a/scenario/scenario_base.py
+++ b/scenario/scenario_base.py
@@ -21,7 +21,10 @@
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")