Merge "Added index files for scenario docmentation"
authorEmma Foley <emma.l.foley@intel.com>
Tue, 10 Oct 2017 13:04:28 +0000 (13:04 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Tue, 10 Oct 2017 13:04:28 +0000 (13:04 +0000)
baro_tests/collectd.py
baro_tests/config_server.py

index 3cd55bf..8d12705 100644 (file)
@@ -11,6 +11,7 @@
 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 # License for the specific language governing permissions and limitations
 # under the License.
+# Patch on October 09 2017
 
 """Executing test of plugins"""
 
@@ -742,8 +743,9 @@ def main(bt_logger=None):
     create_ovs_bridge()
     gnocchi_running_on_con = False
     aodh_running_on_con = False
-    snmp_running = True
-    _print_label('Testing Gnocchi, AODH and SNMP on nodes')
+    # Disabling SNMP write plug-in
+    snmp_running = False
+    _print_label('Testing Gnocchi and AODH plugins on nodes')
 
     for controller in controllers:
         gnocchi_running = (
@@ -778,7 +780,7 @@ def main(bt_logger=None):
                 compute_node))
         aodh_running = (
             aodh_running and conf.check_aodh_plugin_included(compute_node))
-        logger.info("SNMP enabled on {}" .format(node_name))
+        logger.info("SNMP enabled on {}" .format(node_name))
         if gnocchi_running:
             out_plugins[node_id].append("Gnocchi")
         if aodh_running:
@@ -787,7 +789,6 @@ def main(bt_logger=None):
             out_plugins[node_id].append("SNMP")
 
         if 'Gnocchi' in out_plugins[node_id]:
-            logger.info("CSV will be enabled for verification")
             plugins_to_enable.append('csv')
             out_plugins[node_id].append("CSV")
             if plugins_to_enable:
@@ -802,36 +803,40 @@ def main(bt_logger=None):
                 logger.info(
                     'Testcases on node {} will not be executed'.format(
                         node_id))
-            else:
-                if plugins_to_enable:
-                    collectd_restarted, collectd_warnings = \
-                        conf.restart_collectd(compute_node)
-                    sleep_time = 10
-                    logger.info(
-                        'Sleeping for {} seconds'.format(sleep_time)
-                        + ' after collectd restart...')
-                    time.sleep(sleep_time)
-                if plugins_to_enable and not collectd_restarted:
+
+        for i in out_plugins[node_id]:
+            if i == 'AODH':
+                for plugin_name in sorted(aodh_plugin_labels.keys()):
+                    _exec_testcase(
+                        aodh_plugin_labels, plugin_name, i,
+                        controllers, compute_node, conf, results,
+                        error_plugins, out_plugins[node_id])
+            elif i == 'CSV':
+                _print_label("Node {}: Executing CSV Testcases".format(
+                    node_name))
+                logger.info("Restarting collectd for CSV tests")
+                collectd_restarted, collectd_warnings = \
+                    conf.restart_collectd(compute_node)
+                sleep_time = 10
+                logger.info(
+                    'Sleeping for {} seconds'.format(sleep_time)
+                    + ' after collectd restart...')
+                time.sleep(sleep_time)
+                if not collectd_restarted:
                     for warning in collectd_warnings:
                         logger.warning(warning)
                     logger.error(
                         'Restart of collectd on node {} failed'.format(
-                            node_id))
+                            compute_node))
                     logger.info(
-                        'Testcases on node {}'.format(node_id)
+                        'CSV Testcases on node {}'.format(compute_node)
                         + ' will not be executed.')
-                else:
-                    if collectd_warnings:
-                        for warning in collectd_warnings:
-                            logger.warning(warning)
-
-        for i in out_plugins[node_id]:
-            if i == 'AODH':
-                for plugin_name in sorted(aodh_plugin_labels.keys()):
+                for plugin_name in sorted(plugin_labels.keys()):
                     _exec_testcase(
-                        aodh_plugin_labels, plugin_name, i,
+                        plugin_labels, plugin_name, i,
                         controllers, compute_node, conf, results,
                         error_plugins, out_plugins[node_id])
+
             else:
                 for plugin_name in sorted(plugin_labels.keys()):
                     _exec_testcase(
@@ -843,10 +848,12 @@ def main(bt_logger=None):
     print_overall_summary(
         compute_ids, plugin_labels, aodh_plugin_labels, results, out_plugins)
 
-    if ((len([res for res in results if not res[2]]) > 0)
-            or (len(results) < len(computes) * len(plugin_labels))):
-        logger.error('Some tests have failed or have not been executed')
-        return 1
+    for res in results:
+        if res[3] is 'False' or 'None':
+            logger.error('Some tests have failed or have not been executed')
+            return 1
+        else:
+            pass
     return 0
 
 
index a5c8c70..8b597cc 100644 (file)
@@ -269,8 +269,13 @@ class ConfigServer(object):
                 stdout = node.run_cmd(
                     "source overcloudrc.v3;"
                     + "openstack catalog list | grep gnocchi")
-                if 'gnocchi' in stdout:
+                if stdout is None:
+                    return False
+                elif 'gnocchi' in stdout:
                     gnocchi_present = True
+                    return gnocchi_present
+                else:
+                    return False
         return gnocchi_present
 
     def is_aodh_running(self, controller):
@@ -287,8 +292,13 @@ class ConfigServer(object):
                 stdout = node.run_cmd(
                     "source overcloudrc.v3;"
                     + "openstack catalog list | grep aodh")
-                if 'aodh' in stdout:
+                if stdout is None:
+                    return False
+                elif 'aodh' in stdout:
                     aodh_present = True
+                    return aodh_present
+                else:
+                    return False
         return aodh_present
 
     def is_mcelog_installed(self, compute, package):