Integrate BAROMETER feature test case 09/28609/15
authorjose.lausuch <jose.lausuch@ericsson.com>
Tue, 14 Feb 2017 12:37:35 +0000 (13:37 +0100)
committerJose Lausuch <jose.lausuch@ericsson.com>
Tue, 21 Feb 2017 21:18:17 +0000 (21:18 +0000)
Also, add a executor method in VNFBase
to allow re-write it for some cases
where the feature is another python
script instead of shell script.

Change-Id: Id734553dffe32fdc9a0befc3f4c0e29e5d56fc61
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
docker/Dockerfile
functest/ci/config_functest.yaml
functest/ci/testcases.yaml
functest/core/feature_base.py
functest/opnfv_tests/features/barometer.py [new file with mode: 0644]

index 13f43dd..0aefeee 100644 (file)
@@ -84,6 +84,7 @@ RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/doctor ${REPO
 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/ovno ${REPOS_DIR}/ovno
 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/promise ${REPOS_DIR}/promise
 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/netready ${REPOS_DIR}/netready
+RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/barometer ${REPOS_DIR}/barometer
 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/sfc ${REPOS_DIR}/sfc
 RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/securityscanning ${REPOS_DIR}/securityscanning
 RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng ${REPOS_DIR}/releng
@@ -109,6 +110,9 @@ RUN cd ${FUNCTEST_REPO_DIR} \
 RUN cd ${RELENG_MODULE_DIR} \
     && pip install .
 
+RUN cd ${REPOS_DIR}/barometer \
+    && pip install .
+
 RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \
     -not -path "*tests/unit*" |xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755 \
     && find ${FUNCTEST_REPO_DIR} -name "*.sh" |xargs grep \#\! |cut -d\:  -f 1 |xargs chmod -c 755
index 8fa4bd3..3bad1b8 100755 (executable)
@@ -21,6 +21,7 @@ general:
         dir_repo_onos:      /home/opnfv/repos/onos
         repo_promise:       /home/opnfv/repos/promise
         repo_netready:      /home/opnfv/repos/netready
+        repo_barometer:     /home/opnfv/repos/barometer
         repo_doctor:        /home/opnfv/repos/doctor
         repo_copper:        /home/opnfv/repos/copper
         dir_repo_ovno:      /home/opnfv/repos/ovno
index 77bd015..b93b01e 100755 (executable)
@@ -348,6 +348,21 @@ tiers:
                 run:
                      module: 'functest.opnfv_tests.features.netready'
                      class: 'GluonVping'
+            -
+                name: barometer
+                criteria: 'status == "PASS"'
+                blocking: false
+                description: >-
+                    Test suite for the Barometer project. Separate tests verify the
+                    proper configuration and functionality of the following
+                    collectd plugins Ceilometer, Hugepages, Memory RAS (mcelog),
+                    and OVS Events
+                dependencies:
+                    installer: 'fuel'
+                    scenario: 'kvm_ovs_dpdk_bar'
+                run:
+                     module: 'functest.opnfv_tests.features.barometer'
+                     class: 'BarometerCollectd'
     -
         name: components
         order: 3
index fe9a999..2bd1ec8 100644 (file)
@@ -7,6 +7,7 @@ from functest.utils.constants import CONST
 
 
 class FeatureBase(base.TestcaseBase):
+
     def __init__(self, project='functest', case='', repo='', cmd=''):
         super(FeatureBase, self).__init__()
         self.project_name = project
@@ -19,7 +20,7 @@ class FeatureBase(base.TestcaseBase):
     def run(self, **kwargs):
         self.prepare()
         self.start_time = time.time()
-        ret = ft_utils.execute_command(self.cmd, output_file=self.result_file)
+        ret = self.execute()
         self.stop_time = time.time()
         self.post()
         self.parse_results(ret)
@@ -27,6 +28,13 @@ class FeatureBase(base.TestcaseBase):
         self.logger.info("Test result is stored in '%s'" % self.result_file)
         return base.TestcaseBase.EX_OK
 
+    def execute(self):
+        '''
+        Executer method that can be overwritten
+        By default it executes a shell command.
+        '''
+        return ft_utils.execute_command(self.cmd, output_file=self.result_file)
+
     def prepare(self, **kwargs):
         pass
 
diff --git a/functest/opnfv_tests/features/barometer.py b/functest/opnfv_tests/features/barometer.py
new file mode 100644 (file)
index 0000000..aec2bce
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+#
+# 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
+
+
+import functest.core.feature_base as base
+import functest.utils.functest_logger as ft_logger
+
+from baro_tests import collectd
+
+
+class BarometerCollectd(base.FeatureBase):
+    '''
+    Class for executing barometercollectd testcase.
+    '''
+
+    def __init__(self):
+        super(BarometerCollectd, self).__init__(project='barometer',
+                                                case='barometercollectd',
+                                                repo='dir_repo_barometer')
+        self.logger = ft_logger.Logger("BarometerCollectd").getLogger()
+
+    def execute(self):
+        return collectd.main(self.logger)