Adding improvements to SNMP testcases 85/42585/1
authorSharada Shiddibhavi <sharada.shiddibhavi@intel.com>
Wed, 20 Sep 2017 11:33:46 +0000 (11:33 +0000)
committerSharada Shiddibhavi <sharada.shiddibhavi@intel.com>
Wed, 20 Sep 2017 11:37:02 +0000 (11:37 +0000)
This patch contains improvements to testcases for Hugepages,
Intel_RDT and mcelog verification using SNMP

Change-Id: I3451e0acd9c791e6145bb15e7ba8f3525bc0f0e8
Signed-off-by: Sharada Shiddibhavi <sharada.shiddibhavi@intel.com>
baro_tests/collectd.py
baro_tests/config_server.py

index b9ea5ac..4a7aacb 100644 (file)
@@ -323,14 +323,14 @@ def _print_final_result_of_plugin(
             elif (id, out_plugin, plugin, False) in results:
                 print_line += ' FAIL   |'
             else:
-                print_line += ' NOT EX |'
+                print_line += ' FAIL   |'
         elif out_plugin == 'SNMP':
             if (id, out_plugin, plugin, True) in results:
                 print_line += ' PASS   |'
             elif (id, out_plugin, plugin, False) in results:
                 print_line += ' FAIL   |'
             else:
-                print_line += ' NOT EX |'
+                print_line += ' FAIL   |'
         elif out_plugin == 'CSV':
             if (id, out_plugin, plugin, True) in results:
                 print_line += ' PASS   |'
@@ -608,6 +608,7 @@ def create_ovs_bridge():
                                           APEX_USER_STACK,
                                           APEX_PKEY)
     nodes = handler.get_nodes()
+    logger.info("Creating OVS bridges on computes nodes")
     for node in nodes:
         if node.is_compute():
             node.run_cmd('sudo ovs-vsctl add-br br0')
@@ -617,7 +618,7 @@ def create_ovs_bridge():
 
 def mcelog_install():
     """Install mcelog on compute nodes."""
-    _print_label('Enabling mcelog on compute nodes')
+    _print_label('Enabling mcelog and OVS bridges on compute nodes')
     handler = factory.Factory.get_handler('apex',
                                           APEX_IP,
                                           APEX_USER_STACK,
@@ -773,8 +774,7 @@ def main(bt_logger=None):
                 compute_node))
         aodh_running = (
             aodh_running and conf.check_aodh_plugin_included(compute_node))
-        # snmp_running = (
-        # snmp_running or conf.check_snmp_plugin_included(compute_node))
+        logger.info("SNMP enabled on {}" .format(node_name))
         if gnocchi_running:
             out_plugins[node_id].append("Gnocchi")
         if aodh_running:
index 102a237..3178eff 100644 (file)
@@ -101,20 +101,20 @@ class ConfigServer(object):
             stderr_lines = stderr.readlines()
             if stderr_lines:
                 self.__logger.warning(
-                    "'fuel node' command failed (try {}):".format(attempt))
+                    "'Apex node' command failed (try {}):".format(attempt))
                 for line in stderr_lines:
                     self.__logger.debug(line.strip())
             else:
                 fuel_node_passed = True
                 if attempt > 1:
                     self.__logger.info(
-                        "'fuel node' command passed (try {})".format(attempt))
+                        "'Apex node' command passed (try {})".format(attempt))
             attempt += 1
         if not fuel_node_passed:
             self.__logger.error(
-                "'fuel node' command failed. This was the last try.")
+                "'Apex node' command failed. This was the last try.")
             raise OSError(
-                "'fuel node' command failed. This was the last try.")
+                "'Apex node' command failed. This was the last try.")
         node_table = stdout.readlines()\
 
         # skip table title and parse table values
@@ -186,7 +186,6 @@ class ConfigServer(object):
                     'cat /etc/collectd/collectd.conf.d/{}.conf'.format(plugin))
                 for line in stdout.split('\n'):
                     if 'Interval' in line:
-                        # line = line.strip('Interval')
                         return 1
         return default_interval
 
@@ -555,7 +554,7 @@ class ConfigServer(object):
             self, compute, plugin_interval, logger, plugin, snmp_mib_files=[],
             snmp_mib_strings=[], snmp_in_commands=[]):
 
-        if plugin == 'intel_rdt':
+        if plugin == 'hugepages' or 'intel_rdt' or 'mcelog':
             nodes = get_apex_nodes()
             for node in nodes:
                 if compute == node.get_dict()['name']:
@@ -563,7 +562,10 @@ class ConfigServer(object):
                         'snmpwalk -v2c -m {0} -c public localhost {1}' .format(
                             snmp_mib_files, snmp_mib_strings))
                     self.__logger.info("{}" .format(stdout))
-                    if 'OID' in stdout:
+                    if stdout is None:
+                        self.__logger.info("No output from snmpwalk")
+                        return False
+                    elif 'OID' in stdout:
                         self.__logger.info("SNMP query failed")
                         return False
                     else:
@@ -573,7 +575,9 @@ class ConfigServer(object):
                         'snmpwalk -v2c -m {0} -c public localhost {1}' .format(
                             snmp_mib_files, snmp_mib_strings))
                     self.__logger.info("{}" .format(stdout))
-                    if 'OID' in stdout:
+                    if stdout is None:
+                        self.__logger.info("No output from snmpwalk")
+                    elif 'OID' in stdout:
                         self.__logger.info(
                             "SNMP query failed during second check")
                         self.__logger.info("waiting for 10 sec")
@@ -582,7 +586,9 @@ class ConfigServer(object):
                         'snmpwalk -v2c -m {0} -c public localhost {1}' .format(
                             snmp_mib_files, snmp_mib_strings))
                     self.__logger.info("{}" .format(stdout))
-                    if 'OID' in stdout:
+                    if stdout is None:
+                        self.__logger.info("No output from snmpwalk")
+                    elif 'OID' in stdout:
                         self.__logger.info("SNMP query failed again")
                         self.__logger.info("Failing this test case")
                         return False
@@ -593,3 +599,5 @@ class ConfigServer(object):
                         return False
                     else:
                         return True
+        else:
+            return False