Add tungsten and patrole plugins sections

Tungsten plugin contains a set of integration tests to be run
against a live open-contrail cluster. Tungsten plugin based on a
patrole plugin, so we need to integrate both.

Change-Id: I0db64581607730a0c38715b046bff5b7bdf5a0b7
Related-PROD: PROD-24170
diff --git a/_modules/runtest/tempest_sections/__init__.py b/_modules/runtest/tempest_sections/__init__.py
index a320ce8..3dd953c 100644
--- a/_modules/runtest/tempest_sections/__init__.py
+++ b/_modules/runtest/tempest_sections/__init__.py
@@ -21,11 +21,13 @@
 import object_storage_feature_enabled
 import orchestration
 import oslo_concurrency
+import patrole_plugin
 import scenario
 import service_clients
 import service_available
 import share
 import telemetry
+import tungsten_plugin
 import validation
 import volume
 import volume_feature_enabled
@@ -52,11 +54,13 @@
     object_storage_feature_enabled.ObjectStorageFeatureEnabled,
     orchestration.Orchestration,
     oslo_concurrency.OsloConcurrency,
+    patrole_plugin.PatrolePlugin,
     scenario.Scenario,
     service_clients.ServiceClients,
     service_available.ServiceAvailable,
     share.Share,
     telemetry.Telemetry,
+    tungsten_plugin.TungstenPlugin,
     validation.Validation,
     volume.Volume,
     volume_feature_enabled.VolumeFeatureEnabled,
diff --git a/_modules/runtest/tempest_sections/patrole_plugin.py b/_modules/runtest/tempest_sections/patrole_plugin.py
new file mode 100644
index 0000000..8276169
--- /dev/null
+++ b/_modules/runtest/tempest_sections/patrole_plugin.py
@@ -0,0 +1,36 @@
+
+import base_section
+
+from runtest import conditions
+
+
+class PatrolePlugin(base_section.BaseSection):
+
+    name = "patrole"
+    options = [
+        'enable_rbac',
+        'rbac_test_role',
+        'custom_policy_files',
+        'test_custom_requirements',
+        'custom_requirements_file',
+    ]
+
+    @property
+    def enable_rbac(self):
+        return False
+
+    @property
+    def rbac_test_role(self):
+        pass
+
+    @property
+    def custom_policy_files(self):
+        pass
+
+    @property
+    def test_custom_requirements(self):
+        pass
+
+    @property
+    def custom_requirements_file(self):
+        pass
diff --git a/_modules/runtest/tempest_sections/service_available.py b/_modules/runtest/tempest_sections/service_available.py
index df288fd..c31f1db 100644
--- a/_modules/runtest/tempest_sections/service_available.py
+++ b/_modules/runtest/tempest_sections/service_available.py
@@ -10,6 +10,7 @@
         'barbican',
         'cinder',
         'ceilometer',
+        'contrail',
         'designate',
         'glance',
         'gnocchi',
@@ -41,7 +42,8 @@
             if p_service:
                 p_api = (p_service.get('api') or
                          p_service.get('controller') or
-                         p_service.get('server'))
+                         p_service.get('server') or
+                         p_service.get('control'))
 
                 if p_api:
                     if p_api.get('enabled'):
@@ -65,6 +67,10 @@
         return self._is_service_enabled('ceilometer')
 
     @property
+    def contrail(self):
+        return self._is_service_enabled('opencontrail')
+
+    @property
     def designate(self):
         return self._is_service_enabled('designate')
 
diff --git a/_modules/runtest/tempest_sections/tungsten_plugin.py b/_modules/runtest/tempest_sections/tungsten_plugin.py
new file mode 100644
index 0000000..513bc8d
--- /dev/null
+++ b/_modules/runtest/tempest_sections/tungsten_plugin.py
@@ -0,0 +1,28 @@
+
+import base_section
+
+from runtest import conditions
+
+
+class TungstenPlugin(base_section.BaseSection):
+
+    name = "sdn"
+    options = [
+        'endpoint_type',
+        'catalog_type',
+    ]
+
+    @property
+    def endpoint_type(self):
+        return 'internal'
+
+    @property
+    def catalog_type(self):
+        contrail_enabled = conditions.BaseRule('opencontrail.control.enabled',
+                                               'eq', True, multiple='any')
+        if contrail_enabled:
+            c = conditions.BaseRule('keystone.client.enabled', 'eq', True)
+            return self.get_item_when_condition_match(
+                'keystone.client.server.identity.service.opencontrail.type', c)
+        else:
+            pass