Merge "Dynamic creds does not support create subnet with ipv6"
diff --git a/tempest/common/dynamic_creds.py b/tempest/common/dynamic_creds.py
index 88fe26c..1e040e6 100644
--- a/tempest/common/dynamic_creds.py
+++ b/tempest/common/dynamic_creds.py
@@ -12,6 +12,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import ipaddress
+
 import netaddr
 from oslo_log import log as logging
 import six
@@ -275,14 +277,16 @@
                             name=subnet_name,
                             tenant_id=tenant_id,
                             enable_dhcp=self.network_resources['dhcp'],
-                            ip_version=4)
+                            ip_version=(ipaddress.ip_network(
+                                six.text_type(subnet_cidr)).version))
                 else:
                     resp_body = self.subnets_admin_client.\
                         create_subnet(network_id=network_id,
                                       cidr=str(subnet_cidr),
                                       name=subnet_name,
                                       tenant_id=tenant_id,
-                                      ip_version=4)
+                                      ip_version=(ipaddress.ip_network(
+                                          six.text_type(subnet_cidr)).version))
                 break
             except lib_exc.BadRequest as e:
                 if 'overlaps with another subnet' not in str(e):