Move general methods under utils file
As a follow-up to the patch [1].
Better to move these methods under utils file
so other classes can benefit from it.
[1] Ia0cf15210e697988cd54ae82db8bb76aa17a5996
Change-Id: I31322352dcd7982443fa1f590a643b341c059ff0
diff --git a/manila_tempest_tests/utils.py b/manila_tempest_tests/utils.py
index 5ecfb36..caf4caf 100644
--- a/manila_tempest_tests/utils.py
+++ b/manila_tempest_tests/utils.py
@@ -19,8 +19,11 @@
from netaddr import ip
from tempest import config
+from tempest.lib.common.utils import data_utils
import testtools
+from manila_tempest_tests import utils
+
CONF = config.CONF
SHARE_NETWORK_SUBNETS_MICROVERSION = '2.51'
SHARE_REPLICA_QUOTAS_MICROVERSION = "2.53"
@@ -140,6 +143,40 @@
return address
+def generate_share_network_data():
+ data = {
+ "name": data_utils.rand_name("sn-name"),
+ "description": data_utils.rand_name("sn-desc"),
+ "neutron_net_id": data_utils.rand_name("net-id"),
+ "neutron_subnet_id": data_utils.rand_name("subnet-id"),
+ }
+ return data
+
+
+def generate_subnet_data():
+ data = {
+ "neutron_net_id": data_utils.rand_name("net-id"),
+ "neutron_subnet_id": data_utils.rand_name("subnet-id"),
+ }
+ return data
+
+
+def generate_security_service_data(set_ou=False):
+ data = {
+ "name": data_utils.rand_name("ss-name"),
+ "description": data_utils.rand_name("ss-desc"),
+ "dns_ip": utils.rand_ip(),
+ "server": utils.rand_ip(),
+ "domain": data_utils.rand_name("ss-domain"),
+ "user": data_utils.rand_name("ss-user"),
+ "password": data_utils.rand_name("ss-password"),
+ }
+ if set_ou:
+ data["ou"] = data_utils.rand_name("ss-ou")
+
+ return data
+
+
def choose_matching_backend(share, pools, share_type):
extra_specs = {}
# fix extra specs with string values instead of boolean