Merge "Use standard HTTP ports for UI"

This commit is contained in:
Jenkins 2016-07-12 07:48:10 +00:00 committed by Gerrit Code Review
commit 2207902755
3 changed files with 47 additions and 7 deletions

View File

@ -12,6 +12,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from contextlib import closing
import socket
from proboscis import asserts from proboscis import asserts
import requests import requests
@ -56,3 +59,15 @@ def check_process_count(remote, process, count):
len(pids), count, len(pids), count,
msg.format(process=process, count=count, got=len(pids))) msg.format(process=process, count=count, got=len(pids)))
return pids return pids
def check_port(address, port):
"""Check whether or not a TCP port is open.
:param address: server address
:type address: str
:param port: server port
:type port: str
"""
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
return sock.connect_ex((address, port)) == 0

View File

@ -23,6 +23,18 @@ from stacklight_tests.influxdb_grafana import plugin_settings
class InfluxdbPluginApi(base_test.PluginApi): class InfluxdbPluginApi(base_test.PluginApi):
def __init__(self):
super(InfluxdbPluginApi, self).__init__()
self._grafana_port = None
@property
def grafana_port(self):
if self._grafana_port is None:
self._grafana_port = 80
if self.checkers.check_port(self.get_plugin_vip(), 8000):
self._grafana_port = 8000
return self._grafana_port
def get_plugin_settings(self): def get_plugin_settings(self):
return plugin_settings return plugin_settings
@ -39,7 +51,8 @@ class InfluxdbPluginApi(base_test.PluginApi):
return self.helpers.get_plugin_vip(self.settings.vip_name) return self.helpers.get_plugin_vip(self.settings.vip_name)
def get_grafana_url(self, path=''): def get_grafana_url(self, path=''):
return "http://{0}:8000/{1}".format(self.get_plugin_vip(), path) return "http://{0}:{1}/{2}".format(self.get_plugin_vip(),
self.grafana_port, path)
def get_influxdb_url(self, path=''): def get_influxdb_url(self, path=''):
return "http://{0}:8086/{1}".format(self.get_plugin_vip(), path) return "http://{0}:8086/{1}".format(self.get_plugin_vip(), path)
@ -118,8 +131,7 @@ class InfluxdbPluginApi(base_test.PluginApi):
self.settings.name, self.settings.version) self.settings.name, self.settings.version)
def check_grafana_dashboards(self): def check_grafana_dashboards(self):
grafana_url = self.get_grafana_url() ui_api.check_grafana_dashboards(self.get_grafana_url())
ui_api.check_grafana_dashboards(grafana_url)
def get_nova_instance_creation_time_metrics(self, time_point=None): def get_nova_instance_creation_time_metrics(self, time_point=None):
"""Gets instance creation metrics for provided interval """Gets instance creation metrics for provided interval

View File

@ -25,6 +25,18 @@ from stacklight_tests.lma_infrastructure_alerting import(
class InfraAlertingPluginApi(base_test.PluginApi): class InfraAlertingPluginApi(base_test.PluginApi):
def __init__(self):
super(InfraAlertingPluginApi, self).__init__()
self._nagios_port = None
@property
def nagios_port(self):
if self._nagios_port is None:
self._nagios_port = 80
if self.checkers.check_port(self.get_plugin_vip(), 8001):
self._nagios_port = 8001
return self._nagios_port
def get_plugin_settings(self): def get_plugin_settings(self):
return infra_alerting_plugin_settings return infra_alerting_plugin_settings
@ -60,12 +72,13 @@ class InfraAlertingPluginApi(base_test.PluginApi):
) )
def get_authenticated_nagios_url(self): def get_authenticated_nagios_url(self):
return "http://{0}:{1}@{2}:8001".format(self.settings.nagios_user, return "http://{0}:{1}@{2}:{3}".format(self.settings.nagios_user,
self.settings.nagios_password, self.settings.nagios_password,
self.get_plugin_vip()) self.get_plugin_vip(),
self.nagios_port)
def get_nagios_url(self): def get_nagios_url(self):
return "http://{}:8001/".format(self.get_plugin_vip()) return "http://{0}:{1}".format(self.get_plugin_vip(), self.nagios_port)
def open_nagios_page(self, link_text, anchor): def open_nagios_page(self, link_text, anchor):
driver = self.ui_tester.get_driver(self.get_authenticated_nagios_url(), driver = self.ui_tester.get_driver(self.get_authenticated_nagios_url(),