Merge "Port V1 Tempest test from designate's contrib folder"
diff --git a/designate_tempest_plugin/config.py b/designate_tempest_plugin/config.py
index 1dffcf0..611d90f 100644
--- a/designate_tempest_plugin/config.py
+++ b/designate_tempest_plugin/config.py
@@ -40,6 +40,10 @@
     cfg.IntOpt('build_timeout',
                default=60,
                help="Timeout in seconds to wait for an resource to build."),
+    cfg.IntOpt('min_ttl',
+               default=1,
+               help="The minimum value to respect when generating ttls"),
+
 ]
 
 dns_feature_group = cfg.OptGroup(name='dns_feature_enabled',
diff --git a/designate_tempest_plugin/data_utils.py b/designate_tempest_plugin/data_utils.py
index f18e87c..448095e 100644
--- a/designate_tempest_plugin/data_utils.py
+++ b/designate_tempest_plugin/data_utils.py
@@ -15,9 +15,11 @@
 
 import netaddr
 from oslo_log import log as logging
+from tempest import config
 from tempest.lib.common.utils import data_utils
 
 LOG = logging.getLogger(__name__)
+CONF = config.CONF
 
 
 def rand_ip():
@@ -58,6 +60,7 @@
     :return: a random ttl e.g. 165
     :rtype: string
     """
+    start = max(start, CONF.dns.min_ttl)
     return data_utils.rand_int_id(start, end)
 
 
@@ -71,9 +74,9 @@
     if name is None:
         name = rand_zone_name()
     if ttl is None:
-        ttl = str(rand_ttl(1200, 8400))
+        ttl = rand_ttl()
 
-    return zone_base.replace('&', name).replace('#', ttl)
+    return zone_base.replace('&', name).replace('#', str(ttl))
 
 
 def rand_quotas(zones=None, zone_records=None, zone_recordsets=None,
@@ -109,11 +112,11 @@
     if description is None:
         description = rand_zone_name(prefix='Description ', suffix='')
     if ttl is None:
-        ttl = random.randint(1200, 8400),
+        ttl = rand_ttl()
     return {
         'name': name,
         'email': email,
-        'ttl': random.randint(1200, 8400),
+        'ttl': ttl,
         'description': description}
 
 
@@ -128,7 +131,7 @@
     if records is None:
         records = [rand_ip()]
     if ttl is None:
-        ttl = random.randint(1200, 8400)
+        ttl = rand_ttl()
     return {
         'type': record_type,
         'name': name,
diff --git a/requirements.txt b/requirements.txt
index 090a185..b6c32bd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,4 +2,4 @@
 # of appearance. Changing the order has an impact on the overall integration
 # process, which may cause wedges in the gate later.
 
-tempest>=10.0.0  # Apache-2.0
+tempest>=11.0.0 # Apache-2.0