Print an error message and fail if network could not be found by name
When obtaining a network by name, assert that we actually obtain one
instead of failing on a key error.
Related-bug: #1438415
Change-Id: I0e7f487c5d644f178fc770926333cb1e88749b4a
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index bae8296..59d759d 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -680,6 +680,8 @@
def _get_network_by_name(self, network_name):
net = self._list_networks(name=network_name)
+ self.assertNotEqual(len(net), 0,
+ "Unable to get network by name: %s" % network_name)
return net_resources.AttributeDict(net[0])
def create_floating_ip(self, thing, external_network_id=None,
@@ -1049,6 +1051,9 @@
# not (the current baremetal case). Likely can be removed when
# test account mgmt is reworked:
# https://blueprints.launchpad.net/tempest/+spec/test-accounts
+ if not CONF.compute.fixed_network_name:
+ m = 'fixed_network_name must be specified in config'
+ raise exceptions.InvalidConfiguration(m)
network = self._get_network_by_name(
CONF.compute.fixed_network_name)
router = None