Add share section for running manila tests

Change-Id: Ia2addc32d1c0c5ce884cdc778f67aaa147bb0c2b
diff --git a/_modules/runtest/tempest_sections/__init__.py b/_modules/runtest/tempest_sections/__init__.py
index 56b3238..a320ce8 100644
--- a/_modules/runtest/tempest_sections/__init__.py
+++ b/_modules/runtest/tempest_sections/__init__.py
@@ -24,6 +24,7 @@
 import scenario
 import service_clients
 import service_available
+import share
 import telemetry
 import validation
 import volume
@@ -54,6 +55,7 @@
     scenario.Scenario,
     service_clients.ServiceClients,
     service_available.ServiceAvailable,
+    share.Share,
     telemetry.Telemetry,
     validation.Validation,
     volume.Volume,
diff --git a/_modules/runtest/tempest_sections/share.py b/_modules/runtest/tempest_sections/share.py
new file mode 100644
index 0000000..be882df
--- /dev/null
+++ b/_modules/runtest/tempest_sections/share.py
@@ -0,0 +1,177 @@
+from runtest import conditions
+import base_section
+
+
+MICROVERSION_RELEASE_MAPPING = {
+    'pike':
+        {
+            'min_api_microversion': '2.0',
+            'max_api_microversion': '2.40'
+        }
+}
+
+
+class Share(base_section.BaseSection):
+    name = "share"
+    options = [
+        'backend_names',
+        'capability_create_share_from_snapshot_support',
+        'capability_storage_protocol',
+        'default_share_type_name',
+        'enable_ip_rules_for_protocols',
+        'enable_user_rules_for_protocols',
+        'enable_protocols',
+        'max_api_microversion',
+        'min_api_microversion',
+        'multitenancy_enabled',
+        'multi_backend',
+        'run_ipv6_tests',
+        'run_mount_snapshot_tests',
+        'run_migration_with_preserve_snapshots_tests',
+        'run_driver_assisted_migration_tests',
+        'run_host_assisted_migration_tests',
+        'run_replication_tests',
+        'run_manage_unmanage_snapshot_tests',
+        'run_manage_unmanage_tests',
+        'run_share_group_tests',
+        'run_revert_to_snapshot_tests',
+        'run_snapshot_tests',
+        'run_shrink_tests',
+        'run_quota_tests',
+        'suppress_errors_in_cleanup',
+        'share_creation_retry_number',
+    ]
+
+    @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)
+        if backends:
+            for item, value in backends.items():
+                if value.get('enabled', True):
+                    backend_names.append(value['name'])
+        return ', '.join(backend_names)
+
+    @property
+    def capability_create_share_from_snapshot_support(self):
+        pass
+
+    @property
+    def capability_storage_protocol(self):
+        pass
+
+    @property
+    def default_share_type_name(self):
+        pass
+
+    @property
+    def enable_ip_rules_for_protocols(self):
+        pass
+
+    @property
+    def enable_user_rules_for_protocols(self):
+        pass
+
+    @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()
+
+    @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
+
+    @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)
+        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 max_api_microversion(self):
+        c = conditions.BaseRule('manila.api.enabled', 'eq', True)
+        manila_version = self.get_item_when_condition_match('manila.api.version', c)
+        if manila_version:
+            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)
+        if manila_version:
+            return MICROVERSION_RELEASE_MAPPING[manila_version]['min_api_microversion']
+
+    @property
+    def run_ipv6_tests(self):
+        pass
+
+    @property
+    def run_mount_snapshot_tests(self):
+        pass
+
+    @property
+    def run_migration_with_preserve_snapshots_tests(self):
+        pass
+
+    @property
+    def run_driver_assisted_migration_tests(self):
+        pass
+
+    @property
+    def run_host_assisted_migration_tests(self):
+        pass
+
+    @property
+    def run_replication_tests(self):
+        pass
+
+    @property
+    def run_manage_unmanage_snapshot_tests(self):
+        pass
+
+    @property
+    def run_manage_unmanage_tests(self):
+        pass
+
+    @property
+    def run_share_group_tests(self):
+        pass
+
+    @property
+    def run_revert_to_snapshot_tests(self):
+        pass
+
+    @property
+    def run_snapshot_tests(self):
+        pass
+
+    @property
+    def run_shrink_tests(self):
+        pass
+
+    @property
+    def run_quota_tests(self):
+        pass
+
+    # Defines number of retries for share creation.
+    @property
+    def share_creation_retry_number(self):
+        pass
+
+    # Whether to suppress errors with clean up operation or not.
+    @property
+    def suppress_errors_in_cleanup(self):
+        pass
diff --git a/metadata/service/tempest/init.yml b/metadata/service/tempest/init.yml
index 86be784..9546471 100644
--- a/metadata/service/tempest/init.yml
+++ b/metadata/service/tempest/init.yml
@@ -3,7 +3,7 @@
   - service.runtest.tempest.nova
   - service.runtest.tempest.neutron
 applications:
- - runtest
+  - runtest
 parameters:
   _param:
     runtest_heat_plugin_skip_scenario_test_list: 'SoftwareConfigIntegrationTest, VolumeBackupRestoreIntegrationTest, AodhAlarmTest'
diff --git a/metadata/service/tempest/services/manila/backend/lvm.yml b/metadata/service/tempest/services/manila/backend/lvm.yml
new file mode 100644
index 0000000..f60634c
--- /dev/null
+++ b/metadata/service/tempest/services/manila/backend/lvm.yml
@@ -0,0 +1,30 @@
+parameters:
+  _param:
+    tempest_test_target: cfg01*
+  runtest:
+    enabled: true
+    openstack_version: stable/${_param:openstack_version}
+    tempest:
+      enabled: true
+      test_target: ${_param:tempest_test_target}
+      share:
+        capability_create_share_from_snapshot_support: true
+        capability_storage_protocol: NFS_CIFS
+        enable_ip_rules_for_protocols: nfs
+        enable_user_rules_for_protocols: cifs
+        run_ipv6_tests: false
+        run_mount_snapshot_tests: true
+        run_migration_with_preserve_snapshots_tests: false
+        run_driver_assisted_migration_tests: false
+        run_host_assisted_migration_tests: false
+        run_replication_tests: false
+        run_manage_unmanage_snapshot_tests: false
+        run_manage_unmanage_tests: false
+        run_share_group_tests: false
+        run_revert_to_snapshot_tests: true
+        run_snapshot_tests: false
+        run_shrink_tests: false
+        run_quota_tests: false
+        share_creation_retry_number: 2
+        suppress_errors_in_cleanup: true
+        default_share_type_name: default