diff --git a/_modules/runtest/tempest_sections/share.py b/_modules/runtest/tempest_sections/share.py
index be882df..5b1f86c 100644
--- a/_modules/runtest/tempest_sections/share.py
+++ b/_modules/runtest/tempest_sections/share.py
@@ -10,6 +10,187 @@
         }
 }
 
+FEATURE_SUPPORT = {
+    'lvm':
+        {
+            'create_delete_share': 'mitaka',
+            'manage_unmanage_share': '~',
+            'extend_share': 'mitaka',
+            'shrink_share': '~',
+            'create_delete_snapshot': 'mitaka',
+            'create_share_from_snapshot': 'mitaka',
+            'manage_unmanage_snapshot': '~',
+            'revert_to_snapshot': 'ocata',
+            'mountable_snapshot': 'ocata'
+        },
+    'glusterfs':
+        {
+            'create_delete_share': 'juno',
+            'manage_unmanage_share': '~',
+            'extend_share': '~',
+            'shrink_share': '~',
+            'create_delete_snapshot': 'liberty',
+            'create_share_from_snapshot': 'liberty',
+            'manage_unmanage_snapshot': '~',
+            'revert_to_snapshot': '~',
+            'mountable_snapshot': '~'
+        },
+    'nexentastor4':
+        {
+            'create_delete_share': 'newton',
+            'manage_unmanage_share': '~',
+            'extend_share': 'newton',
+            'shrink_share': '~',
+            'create_delete_snapshot': 'newton',
+            'create_share_from_snapshot': 'newton',
+            'manage_unmanage_snapshot': '~',
+            'revert_to_snapshot': '~',
+            'mountable_snapshot': '~'
+        },
+    'nexentastor5':
+        {
+            'create_delete_share': 'newton',
+            'manage_unmanage_share': '~',
+            'extend_share': 'newton',
+            'shrink_share': 'newton',
+            'create_delete_snapshot': 'newton',
+            'create_share_from_snapshot': 'newton',
+            'manage_unmanage_snapshot': '~',
+            'revert_to_snapshot': '~',
+            'mountable_snapshot': '~'
+        }
+}
+
+ACCESS_RULES = {
+    'lvm':
+        {
+            'ipv4':
+                {
+                    'release': 'mitaka',
+                    'protocols': 'nfs'
+                },
+            'ipv6':
+                {
+                    'release': 'pike',
+                    'protocols': 'nfs'
+                },
+            'user':
+                {
+                    'release': 'mitaka',
+                    'protocols': 'cifs'
+                }
+        },
+    'glusterfs':
+        {
+            'ipv4':
+                {
+                    'release': 'juno',
+                    'protocols': 'nfs'
+                },
+            'ipv6':
+                {
+                    'release': '~',
+                    'protocols': ''
+                },
+            'user':
+                {
+                    'release': '~',
+                    'protocols': ''
+                }
+        },
+    'nexentastor4':
+        {
+            'ipv4':
+                {
+                    'release': 'newton',
+                    'protocols': 'nfs'
+                },
+            'ipv6':
+                {
+                    'release': '~',
+                    'protocols': ''
+                },
+            'user':
+                {
+                    'release': '~',
+                    'protocols': ''
+                }
+        },
+    'nexentastor5':
+        {
+             'ipv4':
+                {
+                    'release': 'newton',
+                    'protocols': 'nfs'
+                },
+            'ipv6':
+                {
+                    'release': '~',
+                    'protocols': ''
+                },
+            'user':
+                {
+                    'release': '~',
+                    'protocols': ''
+                }
+        }
+}
+
+COMMON_CAPABILITIES = {
+    'lvm':
+        {
+            'dedupe': '~',
+            'compression': '~',
+            'thin_provisioning': '~',
+            'thick_provisioning': 'mitaka',
+            'qos': '~',
+            'create_share_from_snapshot': 'kilo',
+            'revert_to_snapshot': 'ocata',
+            'mountable_snapshot': 'ocata',
+            'ipv4_support': 'pike',
+            'ipv6_support': 'pike'
+        },
+    'glusterfs':
+        {
+            'dedupe': '~',
+            'compression': '~',
+            'thin_provisioning': '~',
+            'thick_provisioning': 'liberty',
+            'qos': '~',
+            'create_share_from snapshot': 'liberty',
+            'revert_to_snapshot': '~',
+            'mountable_snapshot': '~',
+            'ipv4_support': 'pike',
+            'ipv6_support': '~'
+        },
+    'nexentastor4':
+        {
+            'dedupe': 'newton',
+            'compression': 'newton',
+            'thin_provisioning': 'newton',
+            'thick_provisioning': 'newton',
+            'qos': '~',
+            'create_share_from_snapshot': 'newton',
+            'revert_to_snapshot': '~',
+            'mountable_snapshot': '~',
+            'ipv4_support': 'pike',
+            'ipv6_support': '~'
+        },
+    'nexentastor5':
+        {
+            'dedupe': 'newton',
+            'compression': 'newton',
+            'thin_provisioning': 'newton',
+            'thick_provisioning': 'newton',
+            'qos': '~',
+            'create_share_from_snapshot': 'newton',
+            'revert_to_snapshot': '~',
+            'mountable_snapshot': '~',
+            'ipv4_support': 'newton',
+            'ipv6_support': '~'
+        }
+}
+
 
 class Share(base_section.BaseSection):
     name = "share"
@@ -45,18 +226,29 @@
     @property
     def backend_names(self):
         c = conditions.BaseRule('manila.share.enabled', 'eq', True)
-        backend_names = []
         backends = self.get_item_when_condition_match(
             'manila.share.enabled_share_backends', c)
+        backend_names = []
         if backends:
             for item, value in backends.items():
                 if value.get('enabled', True):
                     backend_names.append(value['name'])
-        return ', '.join(backend_names)
+            return ', '.join(backend_names)
 
     @property
     def capability_create_share_from_snapshot_support(self):
-        pass
+        c = conditions.BaseRule('manila.share.enabled', 'eq', True)
+        manila_version = self.get_item_when_condition_match(
+            'manila.share.version', c)
+        backends = self.get_item_when_condition_match(
+            'manila.share.enabled_share_backends', c)
+        if backends:
+            for item, value in backends.items():
+                driver = value.get('type')
+                if manila_version >= COMMON_CAPABILITIES[driver][
+                    'create_share_from_snapshot']:
+                    return True
+            return False
 
     @property
     def capability_storage_protocol(self):
@@ -64,35 +256,56 @@
 
     @property
     def default_share_type_name(self):
-        pass
+        c = conditions.BaseRule('manila.api.enabled', 'eq', True)
+        return self.get_item_when_condition_match(
+            'manila.common.default_share_type', c)
 
     @property
     def enable_ip_rules_for_protocols(self):
-        pass
+        c = conditions.BaseRule('manila.share.enabled', 'eq', True)
+        manila_version = self.get_item_when_condition_match(
+            'manila.share.version', c)
+        backends = self.get_item_when_condition_match(
+            'manila.share.enabled_share_backends', c)
+        if backends:
+            for item, value in backends.items():
+                driver = value.get('type')
+                if manila_version >= ACCESS_RULES[driver]['ipv4']['release']:
+                    return ACCESS_RULES[driver]['ipv4']['protocols']
 
     @property
     def enable_user_rules_for_protocols(self):
-        pass
+        c = conditions.BaseRule('manila.share.enabled', 'eq', True)
+        manila_version = self.get_item_when_condition_match(
+            'manila.share.version', c)
+        backends = self.get_item_when_condition_match(
+            'manila.share.enabled_share_backends', c)
+        if backends:
+            for item, value in backends.items():
+                driver = value.get('type')
+                if manila_version >= ACCESS_RULES[driver]['user']['release']:
+                    return ACCESS_RULES[driver]['user']['protocols']
 
     @property
     def enable_protocols(self):
-        c = conditions.BaseRule('manila.share.enabled', 'eq', True)
-        proto = self.get_item_when_condition_match(
-            'manila.share.shares.Share2.share_proto', c)
-        if proto:
-            return proto.lower()
+        pass
 
     @property
     def multitenancy_enabled(self):
         c = conditions.BaseRule('manila.share.enabled', 'eq', True)
-        return self.get_item_when_condition_match(
-            'manila.share.shares.Share2.share_type.dhss',
-            c) or False
+        backends = self.get_item_when_condition_match(
+            'manila.share.enabled_share_backends', c)
+        if backends:
+            for item, value in backends.items():
+                if value.get('dhss', True):
+                    return True
+            return False
 
     @property
     def multi_backend(self):
-        c = conditions.BaseRule('manila.api.enabled', 'eq', True)
-        backends = self.get_item_when_condition_match('manila.share.enabled_share_backends', c)
+        c = conditions.BaseRule('manila.share.enabled', 'eq', True)
+        backends = self.get_item_when_condition_match(
+            'manila.share.enabled_share_backends', c)
         backend_names = []
         if backends:
             for item, value in backends.items():
@@ -103,16 +316,20 @@
     @property
     def max_api_microversion(self):
         c = conditions.BaseRule('manila.api.enabled', 'eq', True)
-        manila_version = self.get_item_when_condition_match('manila.api.version', c)
+        manila_version = self.get_item_when_condition_match(
+            'manila.api.version', c)
         if manila_version:
-            return MICROVERSION_RELEASE_MAPPING[manila_version]['max_api_microversion']
+            return MICROVERSION_RELEASE_MAPPING[manila_version][
+                'max_api_microversion']
 
     @property
     def min_api_microversion(self):
         c = conditions.BaseRule('manila.api.enabled', 'eq', True)
-        manila_version = self.get_item_when_condition_match('manila.api.version', c)
+        manila_version = self.get_item_when_condition_match(
+            'manila.api.version', c)
         if manila_version:
-            return MICROVERSION_RELEASE_MAPPING[manila_version]['min_api_microversion']
+            return MICROVERSION_RELEASE_MAPPING[manila_version][
+                'min_api_microversion']
 
     @property
     def run_ipv6_tests(self):
@@ -120,7 +337,18 @@
 
     @property
     def run_mount_snapshot_tests(self):
-        pass
+        c = conditions.BaseRule('manila.share.enabled', 'eq', True)
+        manila_version = self.get_item_when_condition_match(
+            'manila.share.version', c)
+        backends = self.get_item_when_condition_match(
+            'manila.share.enabled_share_backends', c)
+        if backends:
+            for item, value in backends.items():
+                driver = value.get('type')
+                if manila_version >= COMMON_CAPABILITIES[driver][
+                    'mountable_snapshot']:
+                    return True
+            return False
 
     @property
     def run_migration_with_preserve_snapshots_tests(self):
@@ -130,9 +358,11 @@
     def run_driver_assisted_migration_tests(self):
         pass
 
+    # Defines whether to run host-assisted migration tests or not
     @property
     def run_host_assisted_migration_tests(self):
-        pass
+        if conditions.BaseRule('manila.api.enabled', 'eq', True):
+            return False
 
     @property
     def run_replication_tests(self):
@@ -146,13 +376,33 @@
     def run_manage_unmanage_tests(self):
         pass
 
+    # Defines whether to run share group tests or not
     @property
     def run_share_group_tests(self):
-        pass
+        c = conditions.BaseRule('manila.share.enabled', 'eq', True)
+        backends = self.get_item_when_condition_match(
+            'manila.share.enabled_share_backends', c)
+        backend_names = []
+        if backends:
+            for item, value in backends.items():
+                if value.get('enabled', True):
+                    backend_names.append(value['name'])
+            return True if len(backend_names) > 1 else False
 
     @property
     def run_revert_to_snapshot_tests(self):
-        pass
+        c = conditions.BaseRule('manila.share.enabled', 'eq', True)
+        manila_version = self.get_item_when_condition_match(
+            'manila.share.version', c)
+        backends = self.get_item_when_condition_match(
+            'manila.share.enabled_share_backends', c)
+        if backends:
+            for item, value in backends.items():
+                driver = value.get('type')
+                if manila_version >= COMMON_CAPABILITIES[driver][
+                    'revert_to_snapshot']:
+                    return True
+            return False
 
     @property
     def run_snapshot_tests(self):
@@ -160,7 +410,17 @@
 
     @property
     def run_shrink_tests(self):
-        pass
+        c = conditions.BaseRule('manila.share.enabled', 'eq', True)
+        manila_version = self.get_item_when_condition_match(
+            'manila.share.version', c)
+        backends = self.get_item_when_condition_match(
+            'manila.share.enabled_share_backends', c)
+        if backends:
+            for item, value in backends.items():
+                driver = value.get('type')
+                if manila_version >= FEATURE_SUPPORT[driver]['shrink_share']:
+                    return True
+            return False
 
     @property
     def run_quota_tests(self):
@@ -169,9 +429,11 @@
     # Defines number of retries for share creation.
     @property
     def share_creation_retry_number(self):
-        pass
+        if conditions.BaseRule('manila.api.enabled', 'eq', True):
+            return 2
 
     # Whether to suppress errors with clean up operation or not.
     @property
     def suppress_errors_in_cleanup(self):
-        pass
+        if conditions.BaseRule('manila.api.enabled', 'eq', True):
+            return False
\ No newline at end of file
