From 4a173083f549e8a30292b9af9b33b7d7a4efece0 Mon Sep 17 00:00:00 2001 From: Sharada Shiddibhavi Date: Wed, 20 Sep 2017 11:33:46 +0000 Subject: Adding improvements to SNMP testcases This patch contains improvements to testcases for Hugepages, Intel_RDT and mcelog verification using SNMP Change-Id: I3451e0acd9c791e6145bb15e7ba8f3525bc0f0e8 Signed-off-by: Sharada Shiddibhavi (cherry picked from commit b104e2981f0b0ec19f109e220cddc76d97d0ed1a) --- baro_tests/collectd.py | 10 +++++----- baro_tests/config_server.py | 26 +++++++++++++++++--------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/baro_tests/collectd.py b/baro_tests/collectd.py index b9ea5acd..4a7aacbd 100644 --- a/baro_tests/collectd.py +++ b/baro_tests/collectd.py @@ -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: diff --git a/baro_tests/config_server.py b/baro_tests/config_server.py index 102a2377..3178effb 100644 --- a/baro_tests/config_server.py +++ b/baro_tests/config_server.py @@ -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 -- cgit 1.2.3-korg