Add knowledge of storage network to scenario tests
In many deployments, shared file systems are exported
over a shared storage network. Typically, this shared
storage network is not reachable from within
private tenant networks. Our tests currently
have no cognizance of this topology, and expect that
shares are always exported on a network routable or
directly reachable through private tenant networks.
Add a configuration option to allow configuring the
name or UUID of a shared storage network. If specified
this network will be plugged into VMs created by the
scenario tests and access control will be on the
storage network IP, if NFS.
Change-Id: I8d8063d46284076499d868a5f9b3d13a2a78b5b0
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
diff --git a/manila_tempest_tests/tests/scenario/manager.py b/manila_tempest_tests/tests/scenario/manager.py
index 0aa1b9e..e767b02 100644
--- a/manila_tempest_tests/tests/scenario/manager.py
+++ b/manila_tempest_tests/tests/scenario/manager.py
@@ -19,6 +19,7 @@
import netaddr
from oslo_log import log
from oslo_utils import netutils
+from oslo_utils import uuidutils
import six
from tempest.common import compute
@@ -721,12 +722,20 @@
% port_map)
return port_map[0]
- def _get_network_by_name(self, network_name):
- net = self.os_admin.networks_client.list_networks(
- name=network_name)['networks']
- self.assertNotEqual(len(net), 0,
- "Unable to get network by name: %s" % network_name)
- return net[0]
+ def _get_network_by_name_or_id(self, identifier):
+
+ if uuidutils.is_uuid_like(identifier):
+ return self.os_admin.networks_client.show_network(
+ identifier)['network']
+
+ networks = self.os_admin.networks_client.list_networks(
+ name=identifier)['networks']
+ self.assertNotEqual(len(networks), 0,
+ "Unable to get network by name: %s" % identifier)
+ return networks[0]
+
+ def get_networks(self):
+ return self.os_admin.networks_client.list_networks()['networks']
def create_floating_ip(self, thing, external_network_id=None,
port_id=None, client=None):
@@ -1111,7 +1120,7 @@
if not CONF.compute.fixed_network_name:
m = 'fixed_network_name must be specified in config'
raise lib_exc.InvalidConfiguration(m)
- network = self._get_network_by_name(
+ network = self._get_network_by_name_or_id(
CONF.compute.fixed_network_name)
router = None
subnet = None