"""Executing test of plugins"""
# -*- coding: utf-8 -*-
-#Licensed under the Apache License, Version 2.0 (the "License"); you may
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
import logging
from config_server import *
from tests import *
+from opnfv.deployment import factory
+from functest.utils import functest_utils
+from functest.utils.constants import CONST
CEILOMETER_NAME = 'ceilometer'
+ID_RSA_SRC = '/root/.ssh/id_rsa'
+ID_RSA_DST_DIR = '/home/opnfv/.ssh'
+ID_RSA_DST = ID_RSA_DST_DIR + '/id_rsa'
+INSTALLER_PARAMS_YAML = os.path.join(CONST.dir_repo_functest, 'functest/ci/installer_params.yaml')
+FUEL_IP = functest_utils.get_parameter_from_yaml('fuel.ip', INSTALLER_PARAMS_YAML)
+FUEL_USER = functest_utils.get_parameter_from_yaml('fuel.user', INSTALLER_PARAMS_YAML)
+FUEL_PW = functest_utils.get_parameter_from_yaml('fuel.password', INSTALLER_PARAMS_YAML)
class KeystoneException(Exception):
+ "{0}.domain.tld/{1}/{2}-{3}".format(
compute_node.get_id(), plugin_subdir, meter_category, date),
compute_node.get_ip())
- #Storing last two values
+ # Storing last two values
values = stdout
if len(values) < 2:
self._logger.error(
compute_node.get_id(), conf.get_plugin_interval(compute_node, name),
logger=logger, client=CeilometerClient(logger),
criteria_list=ceilometer_criteria_lists[name],
- resource_id_substrings = (ceilometer_substr_lists[name]
- if name in ceilometer_substr_lists else ['']))
+ resource_id_substrings=(ceilometer_substr_lists[name]
+ if name in ceilometer_substr_lists else ['']))
else:
res = test_csv_handles_plugin_data(
compute_node, conf.get_plugin_interval(compute_node, name), name,
_process_result(compute_node.get_id(), test_labels[name], res, results)
+def mcelog_install(logger):
+ """Install mcelog on compute nodes.
+
+ Keyword arguments:
+ logger - logger instance
+ """
+ _print_label('Enabling mcelog on compute nodes')
+ handler = factory.Factory.get_handler('fuel', FUEL_IP, FUEL_USER, installer_pwd='')
+ nodes = handler.get_nodes()
+ openstack_version = handler.get_openstack_version()
+ if openstack_version.find('14.') != 0:
+ logger.info('Mcelog will not be installed,'
+ + ' unsupported Openstack version found ({}).'.format(openstack_version))
+ else:
+ for node in nodes:
+ if node.is_compute():
+ ubuntu_release = node.run_cmd('lsb_release -r')
+ if '16.04' not in ubuntu_release:
+ logger.info('Mcelog will not be enabled'
+ + 'on node-{0}, unsupported Ubuntu release found ({1}).'.format(
+ node.get_dict()['id'], ubuntu_release))
+ else:
+ logger.info('Checking if mcelog is enabled on node-{}...'.format(
+ node.get_dict()['id']))
+ res = node.run_cmd('ls /root/')
+ if 'mce-inject_df' and 'corrected' in res:
+ logger.info('Mcelog seems to be already installed on node-{}.'.format(
+ node.get_dict()['id']))
+ res = node.run_cmd('modprobe mce-inject')
+ res = node.run_cmd('/root/mce-inject_df < /root/corrected')
+ else:
+ logger.info('Mcelog will be enabled on node-{}...'.format(
+ node.get_dict()['id']))
+ res = node.put_file('/home/opnfv/repos/barometer/baro_utils/mce-inject_df',
+ '/root/mce-inject_df')
+ res = node.run_cmd('chmod a+x /root/mce-inject_df')
+ res = node.run_cmd('echo "CPU 0 BANK 0" > /root/corrected')
+ res = node.run_cmd('echo "STATUS 0xcc00008000010090" >> /root/corrected')
+ res = node.run_cmd('echo "ADDR 0x0010FFFFFFF" >> /root/corrected')
+ res = node.run_cmd('modprobe mce-inject')
+ res = node.run_cmd('/root/mce-inject_df < /root/corrected')
+ logger.info('Mcelog is installed on all compute nodes')
+
+
+def mcelog_delete(logger):
+ """Uninstall mcelog from compute nodes.
+
+ Keyword arguments:
+ logger - logger instance
+ """
+ handler = factory.Factory.get_handler('fuel', FUEL_IP, FUEL_USER, installer_pwd='')
+ nodes = handler.get_nodes()
+ for node in nodes:
+ if node.is_compute():
+ output = node.run_cmd('ls /root/')
+ if 'mce-inject_df' in output:
+ res = node.run_cmd('rm /root/mce-inject_df')
+ if 'corrected' in output:
+ res = node.run_cmd('rm /root/corrected')
+ res = node.run_cmd('systemctl restart mcelog')
+ logger.info('Mcelog is deleted from all compute nodes')
+
+
+def get_ssh_keys():
+ if not os.path.isdir(ID_RSA_DST_DIR):
+ os.makedirs(ID_RSA_DST_DIR)
+ if not os.path.isfile(ID_RSA_DST):
+ logger.info("RSA key file {} doesn't exist, it will be downloaded from installer node.".format(ID_RSA_DST))
+ handler = factory.Factory.get_handler('fuel', FUEL_IP, FUEL_USER, installer_pwd=FUEL_PW)
+ fuel = handler.get_installer_node()
+ fuel.get_file(ID_RSA_SRC, ID_RSA_DST)
+ else:
+ logger.info("RSA key file {} exists.".format(ID_RSA_DST))
+
+
def main(bt_logger=None):
"""Check each compute node sends ceilometer metrics.
"""
logging.getLogger("paramiko").setLevel(logging.WARNING)
logging.getLogger("stevedore").setLevel(logging.WARNING)
+ logging.getLogger("opnfv.deployment.manager").setLevel(logging.WARNING)
if bt_logger is None:
_check_logger()
else:
global logger
logger = bt_logger
- conf = ConfigServer('10.20.0.2', 'root', logger)
+ get_ssh_keys()
+ conf = ConfigServer(FUEL_IP, FUEL_USER, logger)
controllers = conf.get_controllers()
if len(controllers) == 0:
logger.error('No controller nodes found!')
logger.info('computes: {}'.format([('{0}: {1} ({2})'.format(
node.get_id(), node.get_name(), node.get_ip())) for node in computes]))
+ mcelog_install(logger) # installation of mcelog
+
ceilometer_running_on_con = False
_print_label('Test Ceilometer on control nodes')
for controller in controllers:
node_id = compute_node.get_id()
out_plugins[node_id] = 'CSV'
compute_ids.append(node_id)
- #plugins_to_enable = plugin_labels.keys()
+ # plugins_to_enable = plugin_labels.keys()
plugins_to_enable = []
_print_label('NODE {}: Test Ceilometer Plug-in'.format(node_id))
logger.info('Checking if ceilometer plug-in is included.')
_print_label('NODE {}: Restoring config file'.format(node_id))
conf.restore_config(compute_node)
+ mcelog_delete(logger) # uninstalling mcelog from compute nodes
+
print_overall_summary(compute_ids, plugin_labels, results, out_plugins)
if ((len([res for res in results if not res[2]]) > 0)
return 1
return 0
+
if __name__ == '__main__':
- sys.exit(main())
+ sys.exit(main())
* *dpdkstat plugin*: A read plugin that retrieve stats from the DPDK extended
NIC stats API.
+* *dpdkevents plugin*: A read plugin that retrieves DPDK link status and DPDK
+ forwarding cores liveliness status (DPDK Keep Alive).
+
* `ceilometer plugin`_: A write plugin that pushes the retrieved stats to
Ceilometer. It's capable of pushing any stats read through collectd to
Ceilometer, not just the DPDK stats.
memory Machine Check Exceptions and sends the stats for reported exceptions
All the plugins above are available on the collectd master, except for the
-plugin as it's a python based plugin and only C plugins are accepted
+ceilometer plugin as it's a python based plugin and only C plugins are accepted
by the collectd community. The ceilometer plugin lives in the OpenStack
repositories.
This will install collectd to /opt/collectd
The collectd configuration file can be found at /opt/collectd/etc
-To configure the hugepages plugin you need to modify the configuration file to
+To configure the dpdkstats plugin you need to modify the configuration file to
include:
.. code:: bash
LoadPlugin dpdkstat
- <Plugin dpdkstat>
- Coremask "0xf"
- ProcessType "secondary"
- FilePrefix "rte"
- EnabledPortMask 0xffff
+ <Plugin "dpdkstat">
+ <EAL>
+ Coremask "0x2"
+ MemoryChannels "4"
+ ProcessType "secondary"
+ FilePrefix "rte"
+ </EAL>
+ EnabledPortMask 0xffff
+ PortName "interface1"
+ PortName "interface2"
</Plugin>
For more information on the plugin parameters, please see:
https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod
-Please note if you are configuring collectd with the **static DPDK library**
-you must compile the DPDK library with the -fPIC flag:
+Please also note that if you are not building and installing DPDK system-wide
+you will need to specify the specific paths to the header files and libraries
+using LIBDPDK_CPPFLAGS and LIBDPDK_LDFLAGS. You will also need to add the DPDK
+library symbols to the shared library path using ldconfig. Note that this
+update to the shared library path is not persistant (i.e. it will not survive a
+reboot).
+
+DPDK events plugin
+^^^^^^^^^^^^^^^^^^^^^^
+Repo: https://github.com/collectd/collectd
+
+Branch: master
+
+Dependencies: DPDK (http://dpdk.org/)
+
+To build and install DPDK to /usr please see:
+https://github.com/collectd/collectd/blob/master/docs/BUILD.dpdkstat.md
+
+Building and installing collectd:
.. code:: bash
- $ make EXTRA_CFLAGS=-fPIC
+ $ git clone https://github.com/maryamtahhan/collectd.git
+ $ cd collectd
+ $ ./build.sh
+ $ ./configure --enable-syslog --enable-logfile --enable-debug
+ $ make
+ $ sudo make install
-You must also modify the configuration step when building collectd:
+This will install collectd to /opt/collectd
+The collectd configuration file can be found at /opt/collectd/etc
+To configure the dpdkevents plugin you need to modify the configuration file to
+include:
.. code:: bash
- $ ./configure CFLAGS=" -lpthread -Wl,--whole-archive -Wl,-ldpdk -Wl,-lm -Wl,-lrt -Wl,-lpcap -Wl,-ldl -Wl,--no-whole-archive"
+ LoadPlugin dpdkevents
+ <Plugin "dpdkevents">
+ Interval 1
+ <EAL>
+ Coremask "0x1"
+ MemoryChannels "4"
+ ProcessType "secondary"
+ FilePrefix "rte"
+ </EAL>
+ <Event "link_status">
+ SendEventsOnUpdate true
+ EnabledPortMask 0xffff
+ PortName "interface1"
+ PortName "interface2"
+ SendNotification false
+ </Event>
+ <Event "keep_alive">
+ SendEventsOnUpdate true
+ LCoreMask "0xf"
+ KeepAliveShmName "/dpdk_keepalive_shm_name"
+ SendNotification false
+ </Event>
+ </Plugin>
+For more information on the plugin parameters, please see:
+https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod
Please also note that if you are not building and installing DPDK system-wide
you will need to specify the specific paths to the header files and libraries
using LIBDPDK_CPPFLAGS and LIBDPDK_LDFLAGS. You will also need to add the DPDK
library symbols to the shared library path using ldconfig. Note that this
update to the shared library path is not persistant (i.e. it will not survive a
-reboot). Pending a merge of https://github.com/collectd/collectd/pull/2073.
+reboot).
.. code:: bash
OvS Stats Branch:feat_ovs_stats
-Dependencies: Open vSwitch, libyajl
+OvS Events MIBs: The SNMP OVS interface link status is provided by standard
+IF-MIB (http://www.net-snmp.org/docs/mibs/IF-MIB.txt)
+
+Dependencies: Open vSwitch, Yet Another JSON Library (https://github.com/lloyd/yajl)
On Ubuntu, install the dependencies:
Socket "/var/run/openvswitch/db.sock"
Interfaces "br0" "veth0"
SendNotification false
+ DispatchValues true
</Plugin>
To configure the OVS stats plugin you need to modify the configuration file