diff --git a/README.rst b/README.rst
index ca88f76..0a2d95b 100644
--- a/README.rst
+++ b/README.rst
@@ -7,7 +7,8 @@
 Tempest plugin to test Manila's features
 
 * Free software: Apache license
-* Documentation: https://docs.openstack.org/developer/openstack
+* Documentation: https://docs.openstack.org/manila/latest/
+* Release notes: https://docs.openstack.org/releasenotes/manila/
 * Source: https://git.openstack.org/cgit/openstack/manila-tempest-plugin
 * Bugs: https://bugs.launchpad.net/manila-tempest-plugin
 
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index d8bd45a..401c089 100644
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -26,7 +26,6 @@
 from tempest import config
 from tempest.lib.common import dynamic_creds
 from tempest.lib.common.utils import data_utils
-from tempest.lib.common.utils import test_utils
 from tempest.lib import exceptions
 from tempest import test
 
@@ -127,9 +126,6 @@
     # Will be cleaned up in resource_cleanup
     class_resources = []
 
-    # Will be cleaned up in clear_net_resources
-    class_net_resources = []
-
     # Will be cleaned up in tearDown method
     method_resources = []
 
@@ -314,14 +310,12 @@
         super(BaseSharesTest, self).setUp()
         self.addCleanup(self.clear_isolated_creds)
         self.addCleanup(self.clear_resources)
-        self.addCleanup(self.clear_net_resources)
         verify_test_has_appropriate_tags(self)
 
     @classmethod
     def resource_cleanup(cls):
         cls.clear_resources(cls.class_resources)
         cls.clear_isolated_creds(cls.class_isolated_creds)
-        cls.clear_net_resources(cls.class_net_resources)
         super(BaseSharesTest, cls).resource_cleanup()
 
     @classmethod
@@ -399,24 +393,6 @@
                         network, subnet, router = net_data
                         net_id = network["id"]
                         subnet_id = subnet["id"]
-                        network_res = {
-                            "type": "network",
-                            "resource": network,
-                            "client": ic,
-                        }
-                        subnet_res = {
-                            "type": "subnet",
-                            "resource": subnet,
-                            "client": ic,
-                        }
-                        router_res = {
-                            "type": "router",
-                            "resource": router,
-                            "client": ic,
-                        }
-                        cls.class_net_resources.insert(0, network_res)
-                        cls.class_net_resources.insert(0, subnet_res)
-                        cls.class_net_resources.insert(0, router_res)
 
                     # Try get suitable share-network
                     share_networks = sc.list_share_networks_with_detail()
@@ -446,58 +422,6 @@
         return share_network_id
 
     @classmethod
-    def clear_net_resources(cls, resources=None):
-        if resources is None:
-            resources = cls.class_net_resources
-        for res in resources:
-            if "deleted" not in res.keys():
-                res["deleted"] = False
-            if not (res["deleted"]):
-                if res["type"] is "router":
-                    cls.clear_router(res['client'], res['resource'])
-                elif res["type"] is "subnet":
-                    cls.clear_subnet(res['client'], res['resource'])
-                elif res["type"] is "network":
-                    cls.clear_network(res['client'], res['resource'])
-                else:
-                    LOG.warning("Provided unsupported resource type for "
-                                "cleanup '%s'. Skipping." % res["type"])
-            res["deleted"] = True
-
-    @classmethod
-    def clear_router(cls, ic, router):
-        body = ic.ports_admin_client.list_ports(device_id=router['id'])
-        interfaces = body['ports']
-        for i in interfaces:
-            test_utils.call_and_ignore_notfound_exc(
-                ic.routers_admin_client.remove_router_interface, router['id'],
-                subnet_id=i['fixed_ips'][0]['subnet_id'])
-
-        try:
-            ic.routers_admin_client.delete_router(router['id'])
-        except exceptions.NotFound:
-            LOG.warning('router with name: %s not found for delete' %
-                        router['name'])
-
-    @classmethod
-    def clear_subnet(cls, ic, subnet):
-        client = ic.subnets_admin_client
-        try:
-            client.delete_subnet(subnet['id'])
-        except exceptions.NotFound:
-            LOG.warning('subnet with name: %s not found for delete' %
-                        subnet['name'])
-
-    @classmethod
-    def clear_network(cls, ic, network):
-        net_client = ic.networks_admin_client
-        try:
-            net_client.delete_network(network['id'])
-        except exceptions.NotFound:
-            LOG.warning('network with name: %s not found for delete' %
-                        network['name'])
-
-    @classmethod
     def _create_share(cls, share_protocol=None, size=None, name=None,
                       snapshot_id=None, description=None, metadata=None,
                       share_network_id=None, share_type_id=None,
@@ -991,8 +915,8 @@
                         client.wait_for_resource_deletion(snapshot_id=res_id)
                     elif (res["type"] is "share_network" and
                             res_id != CONF.share.share_network_id):
-                            client.delete_share_network(res_id)
-                            client.wait_for_resource_deletion(sn_id=res_id)
+                        client.delete_share_network(res_id)
+                        client.wait_for_resource_deletion(sn_id=res_id)
                     elif res["type"] is "security_service":
                         client.delete_security_service(res_id)
                         client.wait_for_resource_deletion(ss_id=res_id)
diff --git a/manila_tempest_tests/tests/api/test_rules_negative.py b/manila_tempest_tests/tests/api/test_rules_negative.py
index 22f232f..19db6bb 100644
--- a/manila_tempest_tests/tests/api/test_rules_negative.py
+++ b/manila_tempest_tests/tests/api/test_rules_negative.py
@@ -124,6 +124,39 @@
                 rule_id=rule["id"], share_id=self.share["id"], version=version)
 
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
+    @ddt.data("10.20.30.40", "fd8c:b029:bba6:ac54::1",
+              "fd2c:b029:bba6:df54::1/128", "10.10.30.40/32")
+    def test_create_duplicate_single_host_rules(self, access_to):
+        """Test rules for individual clients with and without max-prefix."""
+        if ':' in access_to and utils.is_microversion_lt(
+                '2.38', CONF.share.max_api_microversion):
+            reason = ("Skipped. IPv6 rules are accepted from and beyond "
+                      "API version 2.38, the configured maximum API version "
+                      "is %s" % CONF.share.max_api_microversion)
+            raise self.skipException(reason)
+
+        rule = self.shares_v2_client.create_access_rule(
+            self.share["id"], "ip", access_to)
+        self.addCleanup(self.shares_v2_client.delete_access_rule,
+                        self.share["id"], rule['id'])
+        self.shares_v2_client.wait_for_share_status(
+            self.share["id"], "active", status_attr='access_rules_status')
+
+        self.assertRaises(lib_exc.BadRequest,
+                          self.shares_v2_client.create_access_rule,
+                          self.share["id"], "ip", access_to)
+
+        if '/' in access_to:
+            access_to = access_to.split("/")[0]
+        else:
+            access_to = ('%s/32' % access_to if '.' in access_to else
+                         '%s/128' % access_to)
+
+        self.assertRaises(lib_exc.BadRequest,
+                          self.shares_v2_client.create_access_rule,
+                          self.share["id"], "ip", access_to)
+
+    @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
     def test_add_access_rule_on_share_with_no_host(self):
         access_type, access_to = self._get_access_rule_data_from_config()
         extra_specs = self.add_extra_specs_to_dict(
diff --git a/manila_tempest_tests/tests/api/test_snapshot_rules_negative.py b/manila_tempest_tests/tests/api/test_snapshot_rules_negative.py
index 2991acd..2f3f193 100644
--- a/manila_tempest_tests/tests/api/test_snapshot_rules_negative.py
+++ b/manila_tempest_tests/tests/api/test_snapshot_rules_negative.py
@@ -21,6 +21,7 @@
 
 from manila_tempest_tests.tests.api import base
 from manila_tempest_tests.tests.api import test_snapshot_rules
+from manila_tempest_tests import utils
 
 CONF = config.CONF
 
@@ -58,14 +59,22 @@
                           self.snap["id"], "ip", target)
 
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
-    def test_create_duplicate_of_ip_rule(self):
-        self._test_duplicate_rules()
-        self._test_duplicate_rules()
+    @ddt.data("1.2.3.4", "fd8c:b029:bba6:ac54::1",
+              "fd8c:b029:bba6:ac54::1/128", "1.2.3.4/32")
+    def test_create_duplicate_of_ip_rule(self, access_to):
+        self._test_duplicate_rules(access_to)
+        self._test_duplicate_rules(access_to)
 
-    def _test_duplicate_rules(self):
+    def _test_duplicate_rules(self, access_to):
+        if ':' in access_to and utils.is_microversion_lt(
+                '2.38', CONF.share.max_api_microversion):
+            reason = ("Skipped. IPv6 rules are accepted from and beyond "
+                      "API version 2.38, the configured maximum API version "
+                      "is %s" % CONF.share.max_api_microversion)
+            raise self.skipException(reason)
+
         # test data
         access_type = "ip"
-        access_to = "1.2.3.4"
 
         # create rule
         rule = self.shares_v2_client.create_snapshot_access_rule(
@@ -79,6 +88,16 @@
                           self.shares_v2_client.create_snapshot_access_rule,
                           self.snap["id"], access_type, access_to)
 
+        # try alternate notation
+        if '/' in access_to:
+            access_to = access_to.split("/")[0]
+        else:
+            access_to = ('%s/32' % access_to if '.' in access_to else
+                         '%s/128' % access_to)
+        self.assertRaises(lib_exc.BadRequest,
+                          self.shares_v2_client.create_snapshot_access_rule,
+                          self.snap["id"], access_type, access_to)
+
         # delete rule and wait for deletion
         self.shares_v2_client.delete_snapshot_access_rule(self.snap['id'],
                                                           rule['id'])
diff --git a/manila_tempest_tests/tests/scenario/manager.py b/manila_tempest_tests/tests/scenario/manager.py
index 73a6693..0aa1b9e 100644
--- a/manila_tempest_tests/tests/scenario/manager.py
+++ b/manila_tempest_tests/tests/scenario/manager.py
@@ -18,7 +18,6 @@
 
 import netaddr
 from oslo_log import log
-from oslo_serialization import jsonutils as json
 from oslo_utils import netutils
 import six
 
@@ -81,13 +80,6 @@
         cls.security_group_rules_client = (
             cls.os_primary.security_group_rules_client)
 
-        if CONF.volume_feature_enabled.api_v2:
-            cls.volumes_client = cls.os_primary.volumes_v2_client
-            cls.snapshots_client = cls.os_primary.snapshots_v2_client
-        else:
-            cls.volumes_client = cls.os_primary.volumes_client
-            cls.snapshots_client = cls.os_primary.snapshots_client
-
     # ## Test functions library
     #
     # The create_[resource] functions only return body and discard the
@@ -214,61 +206,6 @@
         server = clients.servers_client.show_server(body['id'])['server']
         return server
 
-    def create_volume(self, size=None, name=None, snapshot_id=None,
-                      imageRef=None, volume_type=None):
-        if size is None:
-            size = CONF.volume.volume_size
-        if imageRef:
-            image = self.compute_images_client.show_image(imageRef)['image']
-            min_disk = image.get('minDisk')
-            size = max(size, min_disk)
-        if name is None:
-            name = data_utils.rand_name(self.__class__.__name__ + "-volume")
-        kwargs = {'display_name': name,
-                  'snapshot_id': snapshot_id,
-                  'imageRef': imageRef,
-                  'volume_type': volume_type,
-                  'size': size}
-        volume = self.volumes_client.create_volume(**kwargs)['volume']
-
-        self.addCleanup(self.volumes_client.wait_for_resource_deletion,
-                        volume['id'])
-        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
-                        self.volumes_client.delete_volume, volume['id'])
-
-        # NOTE(e0ne): Cinder API v2 uses name instead of display_name
-        if 'display_name' in volume:
-            self.assertEqual(name, volume['display_name'])
-        else:
-            self.assertEqual(name, volume['name'])
-        waiters.wait_for_volume_resource_status(self.volumes_client,
-                                                volume['id'], 'available')
-        # The volume retrieved on creation has a non-up-to-date status.
-        # Retrieval after it becomes active ensures correct details.
-        volume = self.volumes_client.show_volume(volume['id'])['volume']
-        return volume
-
-    def create_volume_type(self, client=None, name=None, backend_name=None):
-        if not client:
-            client = self.admin_volume_types_client
-        if not name:
-            class_name = self.__class__.__name__
-            name = data_utils.rand_name(class_name + '-volume-type')
-        randomized_name = data_utils.rand_name('scenario-type-' + name)
-
-        LOG.debug("Creating a volume type: %s on backend %s",
-                  randomized_name, backend_name)
-        extra_specs = {}
-        if backend_name:
-            extra_specs = {"volume_backend_name": backend_name}
-
-        body = client.create_volume_type(name=randomized_name,
-                                         extra_specs=extra_specs)
-        volume_type = body['volume_type']
-        self.assertIn('id', volume_type)
-        self.addCleanup(client.delete_volume_type, volume_type['id'])
-        return volume_type
-
     def _create_loginable_secgroup_rule(self, secgroup_id=None):
         _client = self.compute_security_groups_client
         _client_rules = self.compute_security_group_rules_client
@@ -443,72 +380,6 @@
         if not isinstance(exc, lib_exc.SSHTimeout):
             LOG.debug('Network information on a devstack host')
 
-    def create_server_snapshot(self, server, name=None):
-        # Glance client
-        _image_client = self.image_client
-        # Compute client
-        _images_client = self.compute_images_client
-        if name is None:
-            name = data_utils.rand_name(self.__class__.__name__ + 'snapshot')
-        LOG.debug("Creating a snapshot image for server: %s", server['name'])
-        image = _images_client.create_image(server['id'], name=name)
-        image_id = image.response['location'].split('images/')[1]
-        waiters.wait_for_image_status(_image_client, image_id, 'active')
-
-        self.addCleanup(_image_client.wait_for_resource_deletion,
-                        image_id)
-        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
-                        _image_client.delete_image, image_id)
-
-        if CONF.image_feature_enabled.api_v1:
-            # In glance v1 the additional properties are stored in the headers.
-            resp = _image_client.check_image(image_id)
-            snapshot_image = common_image.get_image_meta_from_headers(resp)
-            image_props = snapshot_image.get('properties', {})
-        else:
-            # In glance v2 the additional properties are flattened.
-            snapshot_image = _image_client.show_image(image_id)
-            image_props = snapshot_image
-
-        bdm = image_props.get('block_device_mapping')
-        if bdm:
-            bdm = json.loads(bdm)
-            if bdm and 'snapshot_id' in bdm[0]:
-                snapshot_id = bdm[0]['snapshot_id']
-                self.addCleanup(
-                    self.snapshots_client.wait_for_resource_deletion,
-                    snapshot_id)
-                self.addCleanup(test_utils.call_and_ignore_notfound_exc,
-                                self.snapshots_client.delete_snapshot,
-                                snapshot_id)
-                waiters.wait_for_volume_resource_status(self.snapshots_client,
-                                                        snapshot_id,
-                                                        'available')
-        image_name = snapshot_image['name']
-        self.assertEqual(name, image_name)
-        LOG.debug("Created snapshot image %s for server %s",
-                  image_name, server['name'])
-        return snapshot_image
-
-    def nova_volume_attach(self, server, volume_to_attach):
-        volume = self.servers_client.attach_volume(
-            server['id'], volumeId=volume_to_attach['id'], device='/dev/%s'
-            % CONF.compute.volume_device_name)['volumeAttachment']
-        self.assertEqual(volume_to_attach['id'], volume['id'])
-        waiters.wait_for_volume_resource_status(self.volumes_client,
-                                                volume['id'], 'in-use')
-
-        # Return the updated volume after the attachment
-        return self.volumes_client.show_volume(volume['id'])['volume']
-
-    def nova_volume_detach(self, server, volume):
-        self.servers_client.detach_volume(server['id'], volume['id'])
-        waiters.wait_for_volume_resource_status(self.volumes_client,
-                                                volume['id'], 'available')
-
-        volume = self.volumes_client.show_volume(volume['id'])['volume']
-        self.assertEqual('available', volume['status'])
-
     def rebuild_server(self, server_id, image=None,
                        preserve_ephemeral=False, wait=True,
                        rebuild_kwargs=None):
