Fix Zabbix smoke bvt test suite for enabling use of MOS 7, 8 and 9.x
Change openrc.default for more parametrization options not requiring editing the file Change-Id: I41e762fc0eb39956a88ffe0fc704f167f02a9c4f
This commit is contained in:
parent
078a76b013
commit
41195d5258
@ -1,5 +1,49 @@
|
||||
export ENV_NAME=fuel_stacklight_plugin
|
||||
export VENV_PATH=$HOME/venv-stacklight-tests
|
||||
if [ $# -gt 1 ]; then
|
||||
echo "No more than 1 argument"
|
||||
return
|
||||
fi
|
||||
if [ $# -eq 1 ]; then
|
||||
MOS_VERSION=$1
|
||||
else
|
||||
MOS_VERSION=9.0
|
||||
fi
|
||||
|
||||
# Network characteristics reset (mainly for MOS 7.0)
|
||||
unset NEUTRON_ENABLE
|
||||
unset NEUTRON_SEGMENT_TYPE
|
||||
unset VENV_PREFIX
|
||||
|
||||
case "${MOS_VERSION}" in
|
||||
"7.0")
|
||||
# Location for fuel-qa
|
||||
export FUELQA_GITREF=stable/7.0
|
||||
# Network characteristics
|
||||
export NEUTRON_ENABLE=true
|
||||
export NEUTRON_SEGMENT_TYPE=vlan
|
||||
;;
|
||||
"8.0")
|
||||
# Location for fuel-qa
|
||||
export FUELQA_GITREF=stable/8.0
|
||||
;;
|
||||
"9.0" | "9.1")
|
||||
# Location for fuel-qa
|
||||
export FUELQA_GITREF=stable/mitaka
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported MOS version $MOS_VERSION. Should be one of 7.0, 8.0, 9.0 or 9.1"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
# Locations for MOS
|
||||
export ISO_BASE=${MY_ISO_BASE:-$HOME/iso}
|
||||
export ISO_PATH=${ISO_BASE}/MirantisOpenStack-${MOS_VERSION}.iso
|
||||
|
||||
export ENV_PREFIX=${MY_ENV_PREFIX:-fuel_stacklight_plugin}
|
||||
export ENV_NAME=${ENV_PREFIX}-${MOS_VERSION}
|
||||
export VENV_BASE=${MY_VENV_BASE:-$HOME}
|
||||
export VENV_PREFIX=${VENV_PREFIX:-stacklight-tests}
|
||||
export VENV_PATH=${VENV_BASE}/venv-${VENV_PREFIX}-${MOS_VERSION}
|
||||
|
||||
# Change this if you didn't use the default database password
|
||||
export DEVOPS_DB_PASSWORD=devops
|
||||
@ -9,18 +53,20 @@ export ADMIN_NODE_MEMORY=4096
|
||||
export ADMIN_NODE_CPU=2
|
||||
export SLAVE_NODE_MEMORY=5120
|
||||
|
||||
# Locations for fuel-qa, MOS and plugins artefacts
|
||||
export FUELQA_GITREF=stable/mitaka
|
||||
export ISO_PATH=$HOME/iso/MirantisOpenStack-9.0.iso
|
||||
export LMA_COLLECTOR_PLUGIN_PATH=$HOME/plugins/lma_collector-0.9-0.9.0-1.noarch.rpm
|
||||
export LMA_INFRA_ALERTING_PLUGIN_PATH=$HOME/plugins/lma_infrastructure_alerting-0.9-0.9.0-1.noarch.rpm
|
||||
export ELASTICSEARCH_KIBANA_PLUGIN_PATH=$HOME/plugins/elasticsearch_kibana-0.9-0.9.0-1.noarch.rpm
|
||||
export INFLUXDB_GRAFANA_PLUGIN_PATH=$HOME/plugins/influxdb_grafana-0.9-0.9.0-1.noarch.rpm
|
||||
# Locations for plugins artefacts
|
||||
export PLUGINS_HOME=${MY_PLUGINS_HOME:-$HOME/plugins}
|
||||
|
||||
# Stacklight/LMA plugins
|
||||
export LMA_COLLECTOR_PLUGIN_PATH=${PLUGINS_HOME}/lma_collector-0.9-0.9.0-1.noarch.rpm
|
||||
export LMA_INFRA_ALERTING_PLUGIN_PATH=${PLUGINS_HOME}/lma_infrastructure_alerting-0.9-0.9.0-1.noarch.rpm
|
||||
export ELASTICSEARCH_KIBANA_PLUGIN_PATH=${PLUGINS_HOME}/elasticsearch_kibana-0.9-0.9.0-1.noarch.rpm
|
||||
export INFLUXDB_GRAFANA_PLUGIN_PATH=${PLUGINS_HOME}/influxdb_grafana-0.9-0.9.0-1.noarch.rpm
|
||||
|
||||
# Zabbix plugins
|
||||
export ZABBIX_MONITORING_PLUGIN_PATH=$HOME/plugins/zabbix_monitoring-2.5-2.5.1-1.noarch.rpm
|
||||
export ZABBIX_MONITORING_SNMPTRAPD_PLUGIN_PATH=$HOME/plugins/zabbix_snmptrapd-1.1-1.1.0-1.noarch.rpm
|
||||
export ZABBIX_MONITORING_EMC_PLUGIN_PATH=$HOME/plugins/zabbix_monitoring_emc-1.1-1.1.0-1.noarch.rpm
|
||||
export ZABBIX_MONITORING_EXTREME_NETWORKS_PLUGIN_PATH=$HOME/plugins/zabbix_monitoring_extreme_networks-1.1-1.1.0-1.noarch.rpm
|
||||
export ZABBIX_MONITORING_PLUGIN_PATH=${PLUGINS_HOME}/zabbix_monitoring-2.5-2.5.1-1.noarch.rpm
|
||||
export ZABBIX_MONITORING_SNMPTRAPD_PLUGIN_PATH=${PLUGINS_HOME}/zabbix_snmptrapd-1.1-1.1.0-1.noarch.rpm
|
||||
export ZABBIX_MONITORING_EMC_PLUGIN_PATH=${PLUGINS_HOME}/zabbix_monitoring_emc-1.1-1.1.0-1.noarch.rpm
|
||||
export ZABBIX_MONITORING_EXTREME_NETWORKS_PLUGIN_PATH=${PLUGINS_HOME}/zabbix_monitoring_extreme_networks-1.1-1.1.0-1.noarch.rpm
|
||||
|
||||
# UI Tests settings
|
||||
export SELENIUM_HEADLESS=True
|
||||
|
@ -21,12 +21,12 @@ import time
|
||||
import urllib2
|
||||
|
||||
from devops.helpers import helpers
|
||||
from fuelweb_test.helpers import checkers
|
||||
from fuelweb_test.helpers import os_actions
|
||||
from fuelweb_test import logger
|
||||
from proboscis import asserts
|
||||
|
||||
from stacklight_tests.helpers import remote_ops
|
||||
from stacklight_tests import settings
|
||||
from stacklight_tests import settings as conf
|
||||
|
||||
|
||||
PLUGIN_PACKAGE_RE = re.compile(r'([^/]+)-(\d+\.\d+)-(\d+\.\d+\.\d+)')
|
||||
@ -78,12 +78,36 @@ def get_fixture(name):
|
||||
return path
|
||||
|
||||
|
||||
def mos7_get_ssh_for_nailgun_node(target, node):
|
||||
return target.environment.d_env.get_ssh_to_remote(node['ip'])
|
||||
|
||||
|
||||
def mos7_upload_plugin(plugin, source=None):
|
||||
with source.get_admin_remote() as remote:
|
||||
checkers.upload_tarball(
|
||||
remote, plugin, "/var")
|
||||
|
||||
|
||||
def mos7_install_plugin(plugin_file_name, source=None):
|
||||
with source.get_admin_remote() as remote:
|
||||
checkers.install_plugin_check_code(
|
||||
remote, plugin=plugin_file_name)
|
||||
|
||||
|
||||
class PluginHelper(object):
|
||||
"""Class for common help functions."""
|
||||
|
||||
def __init__(self, env):
|
||||
self.env = env
|
||||
self.fuel_web = self.env.fuel_web
|
||||
# This method does not exist in MOS 7.0
|
||||
# Using Monkey-patching on class. The benefit is that the code
|
||||
# modifications required to get everything to work properly
|
||||
# on every supported version os MOS is located here and there is no
|
||||
# need to modify any other existing code in the test suite
|
||||
wtype = type(self.fuel_web)
|
||||
if not hasattr(wtype, 'get_ssh_for_nailgun_node'):
|
||||
wtype.get_ssh_for_nailgun_node = mos7_get_ssh_for_nailgun_node
|
||||
self._cluster_id = None
|
||||
self.nailgun_client = self.fuel_web.client
|
||||
self._os_conn = None
|
||||
@ -110,9 +134,16 @@ class PluginHelper(object):
|
||||
|
||||
def prepare_plugin(self, plugin_path):
|
||||
"""Upload and install plugin by path."""
|
||||
self.env.admin_actions.upload_plugin(plugin=plugin_path)
|
||||
self.env.admin_actions.install_plugin(
|
||||
plugin_file_name=os.path.basename(plugin_path))
|
||||
# This method does not exist in MOS 7.0
|
||||
if not hasattr(self.env.admin_actions, 'upload_plugin'):
|
||||
mos7_upload_plugin(plugin=plugin_path, source=self.env.d_env)
|
||||
mos7_install_plugin(
|
||||
plugin_file_name=os.path.basename(plugin_path),
|
||||
source=self.env.d_env)
|
||||
else:
|
||||
self.env.admin_actions.upload_plugin(plugin=plugin_path)
|
||||
self.env.admin_actions.install_plugin(
|
||||
plugin_file_name=os.path.basename(plugin_path))
|
||||
|
||||
def get_plugin_setting(self, plugin, parameter):
|
||||
"""Return the given parameter's value for the plugin.
|
||||
@ -171,12 +202,18 @@ class PluginHelper(object):
|
||||
attributes = attributes['editable'][name]
|
||||
|
||||
plugin_data = None
|
||||
for item in attributes['metadata']['versions']:
|
||||
if item['metadata']['plugin_version'] == version:
|
||||
plugin_data = item
|
||||
break
|
||||
asserts.assert_is_not_none(
|
||||
plugin_data, "Plugin {0} ({1}) is not found".format(name, version))
|
||||
# This key does not exist in MOS 7.0
|
||||
if 'versions' in attributes['metadata']:
|
||||
for item in attributes['metadata']['versions']:
|
||||
if item['metadata']['plugin_version'] == version:
|
||||
plugin_data = item
|
||||
break
|
||||
asserts.assert_is_not_none(
|
||||
plugin_data,
|
||||
"Plugin {0} ({1}) is not found".format(
|
||||
name, version))
|
||||
else:
|
||||
plugin_data = attributes
|
||||
|
||||
attributes['metadata']['enabled'] = True
|
||||
for option, value in options.items():
|
||||
@ -232,6 +269,13 @@ class PluginHelper(object):
|
||||
"""
|
||||
if not name:
|
||||
name = self.__class__.__name__
|
||||
# For MOS 7.0 as default network is Nova
|
||||
# The global environment variables should have been set via openrc file
|
||||
if hasattr(conf, 'NEUTRON_ENABLE') and conf.NEUTRON_ENABLE:
|
||||
if settings is None:
|
||||
settings = {}
|
||||
settings["net_provider"] = "neutron"
|
||||
settings["net_segment_type"] = conf.NEUTRON_SEGMENT_TYPE
|
||||
self._cluster_id = self.env.fuel_web.create_cluster(
|
||||
name=name,
|
||||
settings=settings,
|
||||
@ -240,7 +284,7 @@ class PluginHelper(object):
|
||||
|
||||
def deploy_cluster(self, nodes_roles, verify_network=False,
|
||||
update_interfaces=True, check_services=True,
|
||||
timeout=getattr(settings, 'DEPLOYMENT_TIMEOUT', 7800)):
|
||||
timeout=getattr(conf, 'DEPLOYMENT_TIMEOUT', 7800)):
|
||||
"""Assign roles to nodes and deploy the cluster.
|
||||
|
||||
:param nodes_roles: nodes to roles mapping.
|
||||
@ -543,7 +587,7 @@ class PluginHelper(object):
|
||||
"--tenant={tenant_name} --update".format(
|
||||
path=path_to_mu_script,
|
||||
identifier=self.cluster_id,
|
||||
**settings.KEYSTONE_CREDS
|
||||
**conf.KEYSTONE_CREDS
|
||||
)
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user