Remove _create_subnet & create_networks methods

As tempest.scenario.manager was announced stable interface in Tempest 27.0.0[1] it can be now reused in plugins.

Replaced methods:
	* _create_subnet
	* create_networks (not used)

Etherpad concerning this effort:
https://etherpad.opendev.org/p/tempest-scenario-manager-cleanup

[1] https://docs.openstack.org/releasenotes/tempest/v27.0.0.html#release-notes-27-0-0

Change-Id: I516c4bdc5e93ac7521f546102c144bcb1c4d34af
diff --git a/manila_tempest_tests/tests/scenario/manager.py b/manila_tempest_tests/tests/scenario/manager.py
index 6cbaa8b..85d2f27 100644
--- a/manila_tempest_tests/tests/scenario/manager.py
+++ b/manila_tempest_tests/tests/scenario/manager.py
@@ -14,7 +14,6 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import netaddr
 from oslo_log import log
 from oslo_utils import uuidutils
 from tempest.common import image as common_image
@@ -149,95 +148,6 @@
         if not CONF.service_available.neutron:
             raise cls.skipException('Neutron not available')
 
-    def _create_subnet(self, network, subnets_client=None,
-                       routers_client=None, namestart='subnet-smoke',
-                       **kwargs):
-        """Create a subnet for the given network
-
-        within the cidr block configured for tenant networks.
-        """
-        if not subnets_client:
-            subnets_client = self.subnets_client
-        if not routers_client:
-            routers_client = self.routers_client
-
-        def cidr_in_use(cidr, tenant_id):
-            """Check cidr existence
-
-            :returns: True if subnet with cidr already exist in tenant
-                  False else
-            """
-            cidr_in_use = self.os_admin.subnets_client.list_subnets(
-                tenant_id=tenant_id, cidr=cidr)['subnets']
-            return len(cidr_in_use) != 0
-
-        def _make_create_subnet_request(namestart, network,
-                                        ip_version, subnets_client, **kwargs):
-
-            subnet = dict(
-                name=data_utils.rand_name(namestart),
-                network_id=network['id'],
-                tenant_id=network['tenant_id'],
-                ip_version=ip_version,
-                **kwargs
-            )
-
-            if ip_version == 6:
-                subnet['ipv6_address_mode'] = 'slaac'
-                subnet['ipv6_ra_mode'] = 'slaac'
-
-            try:
-                return subnets_client.create_subnet(**subnet)
-            except lib_exc.Conflict as e:
-                if 'overlaps with another subnet' not in str(e):
-                    raise
-
-        result = None
-        str_cidr = None
-
-        use_default_subnetpool = kwargs.get('use_default_subnetpool', False)
-
-        ip_version = kwargs.pop('ip_version', 4)
-
-        if not use_default_subnetpool:
-
-            if ip_version == 6:
-                tenant_cidr = netaddr.IPNetwork(
-                    CONF.network.project_network_v6_cidr)
-                num_bits = CONF.network.project_network_v6_mask_bits
-            else:
-                tenant_cidr = netaddr.IPNetwork(
-                    CONF.network.project_network_cidr)
-                num_bits = CONF.network.project_network_mask_bits
-
-            # Repeatedly attempt subnet creation with sequential cidr
-            # blocks until an unallocated block is found.
-            for subnet_cidr in tenant_cidr.subnet(num_bits):
-                str_cidr = str(subnet_cidr)
-                if cidr_in_use(str_cidr, tenant_id=network['tenant_id']):
-                    continue
-
-                result = _make_create_subnet_request(
-                    namestart, network, ip_version, subnets_client,
-                    cidr=str_cidr, **kwargs)
-                if result is not None:
-                    break
-        else:
-            result = _make_create_subnet_request(
-                namestart, network, ip_version, subnets_client,
-                **kwargs)
-
-        self.assertIsNotNone(result)
-
-        subnet = result['subnet']
-        if str_cidr is not None:
-            self.assertEqual(subnet['cidr'], str_cidr)
-
-        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
-                        subnets_client.delete_subnet, subnet['id'])
-
-        return subnet
-
     def _get_network_by_name_or_id(self, identifier):
 
         if uuidutils.is_uuid_like(identifier):
@@ -572,56 +482,3 @@
         router = self.routers_client.update_router(
             router['id'], **kwargs)['router']
         self.assertEqual(admin_state_up, router['admin_state_up'])
-
-    def create_networks(self, networks_client=None,
-                        routers_client=None, subnets_client=None,
-                        tenant_id=None, dns_nameservers=None,
-                        port_security_enabled=True):
-        """Create a network with a subnet connected to a router.
-
-        The baremetal driver is a special case since all nodes are
-        on the same shared network.
-
-        :param tenant_id: id of tenant to create resources in.
-        :param dns_nameservers: list of dns servers to send to subnet.
-        :returns: network, subnet, router
-        """
-        if CONF.network.shared_physical_network:
-            # NOTE(Shrews): This exception is for environments where tenant
-            # credential isolation is available, but network separation is
-            # not (the current baremetal case). Likely can be removed when
-            # test account mgmt is reworked:
-            # https://blueprints.launchpad.net/tempest/+spec/test-accounts
-            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_or_id(
-                CONF.compute.fixed_network_name)
-            router = None
-            subnet = None
-        else:
-            network = self.create_network(
-                networks_client=networks_client,
-                tenant_id=tenant_id,
-                port_security_enabled=port_security_enabled)
-            router = self._get_router(client=routers_client,
-                                      tenant_id=tenant_id)
-            subnet_kwargs = dict(network=network,
-                                 subnets_client=subnets_client,
-                                 routers_client=routers_client)
-            # use explicit check because empty list is a valid option
-            if dns_nameservers is not None:
-                subnet_kwargs['dns_nameservers'] = dns_nameservers
-            subnet = self._create_subnet(**subnet_kwargs)
-            if not routers_client:
-                routers_client = self.routers_client
-            router_id = router['id']
-            routers_client.add_router_interface(router_id,
-                                                subnet_id=subnet['id'])
-
-            # save a cleanup job to remove this association between
-            # router and subnet
-            self.addCleanup(test_utils.call_and_ignore_notfound_exc,
-                            routers_client.remove_router_interface, router_id,
-                            subnet_id=subnet['id'])
-        return network, subnet, router
diff --git a/manila_tempest_tests/tests/scenario/manager_share.py b/manila_tempest_tests/tests/scenario/manager_share.py
index e1d3a8f..af8f687 100644
--- a/manila_tempest_tests/tests/scenario/manager_share.py
+++ b/manila_tempest_tests/tests/scenario/manager_share.py
@@ -116,7 +116,7 @@
             'ip_version': self.ip_version,
             'use_default_subnetpool': self.ipv6_enabled
         }
-        self.subnet = self._create_subnet(
+        self.subnet = self.create_subnet(
             network=self.network,
             namestart="manila-share-sub",
             **subnet_ip_params)