Allow creating subnet without a gateway

The ability to create a subnet without a gateway was broken
in commit 0ddc93b1b19922d08bedf331b57c363535bb357e.  Change
the create_subnet() method back to using '' as the default
value for the gateway so that callers can pass-in None as
before.  This allows the trunk test to revert to its previous
behavior of passing None.

Change-Id: Ib010f277f4c9ad8a708d16debdcdf8d2ceccd051
Closes-Bug: #1769609
diff --git a/neutron_tempest_plugin/api/base.py b/neutron_tempest_plugin/api/base.py
index fdd8ba9..6700131 100644
--- a/neutron_tempest_plugin/api/base.py
+++ b/neutron_tempest_plugin/api/base.py
@@ -284,7 +284,7 @@
         return network
 
     @classmethod
-    def create_subnet(cls, network, gateway=None, cidr=None, mask_bits=None,
+    def create_subnet(cls, network, gateway='', cidr=None, mask_bits=None,
                       ip_version=None, client=None, **kwargs):
         """Wrapper utility that returns a test subnet.
 
@@ -298,6 +298,7 @@
         It can be a str or a netaddr.IPAddress
         If gateway is not given, then it will use default address for
         given subnet CIDR, like "192.168.0.1" for "192.168.0.0/24" CIDR
+        if gateway is given as None then no gateway will be assigned
 
         :param cidr: CIDR of the subnet to create
         It can be either None, a str or a netaddr.IPNetwork instance
@@ -335,17 +336,19 @@
                         "Gateway IP version doesn't match IP version")
             else:
                 ip_version = gateway_ip.version
+        else:
+            ip_version = ip_version or cls._ip_version
 
         for subnet_cidr in cls.get_subnet_cidrs(
                 ip_version=ip_version, cidr=cidr, mask_bits=mask_bits):
             if cls.try_reserve_subnet_cidr(subnet_cidr):
-                gateway_ip = gateway or str(subnet_cidr.ip + 1)
+                if gateway is not None:
+                    kwargs['gateway_ip'] = str(gateway or (subnet_cidr.ip + 1))
                 try:
                     body = client.create_subnet(
                         network_id=network['id'],
                         cidr=str(subnet_cidr),
                         ip_version=subnet_cidr.version,
-                        gateway_ip=str(gateway_ip),
                         **kwargs)
                     break
                 except lib_exc.BadRequest as e:
diff --git a/neutron_tempest_plugin/scenario/test_trunk.py b/neutron_tempest_plugin/scenario/test_trunk.py
index 6fdcd5b..b5e8cda 100644
--- a/neutron_tempest_plugin/scenario/test_trunk.py
+++ b/neutron_tempest_plugin/scenario/test_trunk.py
@@ -230,7 +230,7 @@
         vlan_tag = 10
 
         vlan_network = self.create_network()
-        self.create_subnet(vlan_network)
+        self.create_subnet(vlan_network, gateway=None)
 
         servers = [
             self._create_server_with_port_and_subport(vlan_network, vlan_tag)