Merge "mibs: Add new mibs to barometer"
authorMaryam Tahhan <maryam.tahhan@intel.com>
Wed, 22 Mar 2017 19:13:11 +0000 (19:13 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Wed, 22 Mar 2017 19:13:11 +0000 (19:13 +0000)
baro_tests/collectd.py
baro_tests/config_server.py
baro_utils/get_ssh_keys.sh [deleted file]
baro_utils/mce-inject_df [new file with mode: 0755]
docs/release/userguide/feature.userguide.rst

index 3f2067a..cd436df 100644 (file)
@@ -1,7 +1,7 @@
 """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
 #
@@ -20,8 +20,18 @@ import time
 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):
@@ -151,7 +161,7 @@ class CSVClient(object):
                     + "{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(
@@ -372,8 +382,8 @@ def _exec_testcase(
                     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,
@@ -387,6 +397,81 @@ def _exec_testcase(
             _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.
 
@@ -395,12 +480,14 @@ def main(bt_logger=None):
     """
     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!')
@@ -416,6 +503,8 @@ def main(bt_logger=None):
     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:
@@ -439,7 +528,7 @@ def main(bt_logger=None):
         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.')
@@ -504,6 +593,8 @@ def main(bt_logger=None):
             _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)
@@ -512,5 +603,6 @@ def main(bt_logger=None):
         return 1
     return 0
 
+
 if __name__ == '__main__':
-     sys.exit(main())
+    sys.exit(main())
index 4d64926..358a8ff 100644 (file)
@@ -69,8 +69,7 @@ class ConfigServer(object):
         self.__private_key_file = ID_RSA_PATH
         if not os.path.isfile(self.__private_key_file):
             self.__logger.error(
-                "Private key file '{}'".format(self.__private_key_file)
-                + " not found. Please try to run {} script.".format(SSH_KEYS_SCRIPT))
+                "Private key file '{}' not found.".format(self.__private_key_file))
             raise IOError("Private key file '{}' not found.".format(self.__private_key_file))
 
         # get list of available nodes
diff --git a/baro_utils/get_ssh_keys.sh b/baro_utils/get_ssh_keys.sh
deleted file mode 100755 (executable)
index f90c32c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-# -*- coding: utf-8 -*-
-
-#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
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-mkdir -p /home/opnfv/.ssh/
-scp root@"$INSTALLER_IP":/root/.ssh/* /home/opnfv/.ssh/
diff --git a/baro_utils/mce-inject_df b/baro_utils/mce-inject_df
new file mode 100755 (executable)
index 0000000..9304181
Binary files /dev/null and b/baro_utils/mce-inject_df differ
index 2be44d3..5ec7442 100644 (file)
@@ -27,6 +27,9 @@ Barometer has enabled the following collectd plugins:
 * *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.
@@ -44,7 +47,7 @@ Barometer has enabled the following collectd plugins:
   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.
 
@@ -154,41 +157,95 @@ Building and installing collectd:
 
 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
 
@@ -551,7 +608,10 @@ OvS Events Branch: master
 
 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:
 
@@ -601,6 +661,7 @@ need to modify the configuration file to include:
        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