Add ability to generate horizon options

For horizon dashboard:
1) if horizon enabled
2) if nginx-proxy enabled, get from nginx pillar: protocol, ip, port
3) if nginx-proxy disabled, get default protocol 'http', ip get from pillar 
'_param.cluster_local_address', port from horizon pillar bind port

Change-Id: Ia089dd8273314a3830c1f552357a8cdb4f14e0a1
Related-Prod: PROD-17611
diff --git a/_modules/runtest/tempest_sections/__init__.py b/_modules/runtest/tempest_sections/__init__.py
index bfa5c8f..91b79ac 100644
--- a/_modules/runtest/tempest_sections/__init__.py
+++ b/_modules/runtest/tempest_sections/__init__.py
@@ -5,6 +5,7 @@
 import baremetal_feature_enabled
 import compute
 import compute_feature_enabled
+import dashboard
 import debug
 import default
 import dns
@@ -33,6 +34,7 @@
     baremetal_feature_enabled.BaremetalFeatureEnabled,
     compute.Compute,
     compute_feature_enabled.ComputeFeatureEnabled,
+    dashboard.Dashboard,
     debug.Debug,
     default.Default,
     dns.Dns,
diff --git a/_modules/runtest/tempest_sections/dashboard.py b/_modules/runtest/tempest_sections/dashboard.py
new file mode 100644
index 0000000..d9a20d0
--- /dev/null
+++ b/_modules/runtest/tempest_sections/dashboard.py
@@ -0,0 +1,42 @@
+import base_section
+
+from runtest import conditions
+
+class Dashboard(base_section.BaseSection):
+
+    name = "dashboard"
+    options = [
+        'dashboard_url',
+        'login_url',
+        'disable_ssl_certificate_validation',
+    ]
+
+
+    @property
+    def dashboard_url(self):
+
+        horizon_enable = conditions.BaseRule('horizon.server.enabled', 'eq', True,multiple='any')
+        if not horizon_enable:
+            return
+
+        nginx_enable = conditions.BaseRule('nginx.server.enabled', 'eq', True)
+
+        if self.get_item_when_condition_match('horizon.server.enabled', horizon_enable):
+            if self.get_item_when_condition_match('nginx.server.enabled', nginx_enable):
+                port = self.get_item_when_condition_match('nginx.server.site.nginx_proxy_openstack_web.host.port', nginx_enable)
+                protocol = self.get_item_when_condition_match('nginx.server.site.nginx_proxy_openstack_web.host.protocol', nginx_enable)
+                ip = self.get_item_when_condition_match('nginx.server.site.nginx_proxy_openstack_web.host.name', nginx_enable)
+            else:
+                port = self.get_item_when_condition_match('horizon.server.bind.port', horizon_enable)
+                protocol = 'http'
+                ip = self.get_item_when_condition_match('_param.cluster_local_address', horizon_enable)
+            return "{}://{}:{}".format(protocol, ip, port)
+
+    @property
+    def login_url(self):
+        if self.dashboard_url:
+            return "{}/auth/login/".format(self.dashboard_url)
+
+    @property
+    def disable_ssl_certificate_validation(self):
+        pass
\ No newline at end of file
diff --git a/_modules/runtest/tempest_sections/service_available.py b/_modules/runtest/tempest_sections/service_available.py
index abe4c1b..381eab8 100644
--- a/_modules/runtest/tempest_sections/service_available.py
+++ b/_modules/runtest/tempest_sections/service_available.py
@@ -14,6 +14,7 @@
         'nova',
         'sahara',
         'swift',
+        'horizon',
     ]
 
 
@@ -76,3 +77,6 @@
     def swift(self):
         return self._is_service_enabled('swift')
 
+    @property
+    def horizon(self):
+        return self._is_service_enabled('horizon')
\ No newline at end of file