diff options
-rw-r--r-- | docker/core/Dockerfile | 2 | ||||
-rw-r--r-- | docs/release/release-notes/functest-release.rst | 148 | ||||
-rw-r--r-- | docs/release/release-notes/index.rst | 2 | ||||
-rw-r--r-- | docs/testing/user/configguide/configguide.rst | 17 | ||||
-rw-r--r-- | functest/ci/check_deployment.py | 163 | ||||
-rw-r--r-- | functest/ci/check_os.sh | 123 | ||||
-rw-r--r-- | functest/ci/prepare_env.py | 38 | ||||
-rw-r--r-- | functest/cli/commands/cli_os.py | 5 | ||||
-rw-r--r-- | functest/opnfv_tests/sdn/odl/odl.py | 4 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/clearwater_ims_base.py | 14 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/cloudify_ims.py | 58 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/cloudify_ims.yaml | 2 | ||||
-rw-r--r-- | functest/tests/unit/ci/test_check_deployment.py | 176 | ||||
-rw-r--r-- | functest/tests/unit/ci/test_prepare_env.py | 24 | ||||
-rw-r--r-- | functest/tests/unit/cli/commands/test_cli_os.py | 10 | ||||
-rw-r--r-- | functest/tests/unit/odl/test_odl.py | 15 | ||||
-rw-r--r-- | setup.cfg | 2 |
17 files changed, 510 insertions, 293 deletions
diff --git a/docker/core/Dockerfile b/docker/core/Dockerfile index ef9f0e2d2..574de9bae 100644 --- a/docker/core/Dockerfile +++ b/docker/core/Dockerfile @@ -5,7 +5,7 @@ ARG OPENSTACK_TAG=stable/ocata RUN apk --no-cache add --update \ python libffi libssl1.0 libjpeg-turbo py-pip bash \ - grep sed wget ca-certificates git && \ + grep sed wget ca-certificates git openssh-client && \ apk --no-cache add --virtual .build-deps --update \ python-dev build-base linux-headers libffi-dev \ openssl-dev libjpeg-turbo-dev && \ diff --git a/docs/release/release-notes/functest-release.rst b/docs/release/release-notes/functest-release.rst index 22393c3a7..fe49657b3 100644 --- a/docs/release/release-notes/functest-release.rst +++ b/docs/release/release-notes/functest-release.rst @@ -14,7 +14,7 @@ You should have received a copy of the license along with this. If not, see <http://creativecommons.org/licenses/by/4.0/>. =========================================== -OPNFV Danube1.0 release note for Functest +OPNFV Danube2.0 release note for Functest =========================================== Abstract @@ -36,6 +36,9 @@ Version history | 2017-03-29 | 4.0.0 | Jose Lausuch | Functest for Danube | | | | (Ericsson) | release | +------------+----------+------------------+------------------------+ +| 2017-05-04 | 5.0.0 | Jose Lausuch | Functest for Danube.2.0| +| | | (Ericsson) | release | ++------------+----------+------------------+------------------------+ OPNFV Danube Release @@ -93,16 +96,16 @@ Release Data | **Project** | functest | | | | +--------------------------------------+--------------------------------------+ -| **Repo/tag** | danube.1.0 | +| **Repo/tag** | danube.2.0 | | | | +--------------------------------------+--------------------------------------+ -| **Release designation** | Danube base release | +| **Release designation** | Danube service release | | | | +--------------------------------------+--------------------------------------+ -| **Release date** | March 31st 2017 | +| **Release date** | May 4st 2017 | | | | +--------------------------------------+--------------------------------------+ -| **Purpose of the delivery** | Danube base release | +| **Purpose of the delivery** | Danube second release | | | | +--------------------------------------+--------------------------------------+ @@ -112,9 +115,9 @@ Deliverables Software -------- - - The Functest Docker image: https://hub.docker.com/r/opnfv/functest (tag: danube.1.0) + - The Functest Docker image: https://hub.docker.com/r/opnfv/functest (tag: danube.2.0) - - The TestAPI Docker image: https://hub.docker.com/r/opnfv/testapi (tag:danube.1.0) + - The TestAPI Docker image: https://hub.docker.com/r/opnfv/testapi (tag:danube.2.0) Documents @@ -192,7 +195,7 @@ New internal tests cases Scenario Matrix =============== -For Danube 1.0, Functest was tested on the following HA scenarios (new +For Danube 2.0, Functest was tested on the following HA scenarios (new dabube scenarios in bold): +---------------------+---------+---------+---------+---------+ @@ -311,21 +314,21 @@ Apex | Scenario | Scoring | Success | Results | | | | rate | | +==================+=========+=========+=================+ -| nosdn | 33/33 | 100% | `apex-res-1`_ | +| nosdn | 30/33 | 91% | `apex-res-1`_ | +------------------+---------+---------+-----------------+ -| odl_l3 | 27/33 | 82% | `apex-res-2`_ | +| odl_l3 | 23/33 | 70% | `apex-res-2`_ | +------------------+---------+---------+-----------------+ -| odl-bgpvpn | 26/30 | 87% | `apex-res-3`_ | +| odl-bgpvpn | 16/36 | 44% | `apex-res-3`_ | +------------------+---------+---------+-----------------+ -| odl-gluon | 30/36 | 83% | `apex-res-4`_ | +| odl-gluon | 18/36 | 50% | `apex-res-4`_ | +------------------+---------+---------+-----------------+ -| kvm | 32/33 | 97% | `apex-res-5`_ | +| kvm | 30/33 | 91% | `apex-res-5`_ | +------------------+---------+---------+-----------------+ -| odl_l2-fdio | 28/36 | 78% | `apex-res-6`_ | +| odl_l2-fdio | 30/36 | 83% | `apex-res-6`_ | +------------------+---------+---------+-----------------+ -| odl_l2-fdio-noha | 30/36 | 83% | `apex-res-7`_ | +| odl_l2-fdio-noha | 29/36 | 81% | `apex-res-7`_ | +------------------+---------+---------+-----------------+ -| odl_l3-fdio-noha | 26/30 | 87% | `apex-res-8`_ | +| odl_l3-fdio-noha | 23/30 | 77% | `apex-res-8`_ | +------------------+---------+---------+-----------------+ | fdio | 6/30 | 20% | `apex-res-9`_ | +------------------+---------+---------+-----------------+ @@ -339,15 +342,15 @@ Compass +==================+=========+=========+==================+ | nosdn | 29/30 | 97% | `compass-res-1`_ | +------------------+---------+---------+------------------+ -| odl_l2 | 28/33 | 84% | `compass-res-2`_ | +| odl_l2 | 29/33 | 88% | `compass-res-2`_ | +------------------+---------+---------+------------------+ -| odl_l3 | 21/30 | 70% | `compass-res-3`_ | +| odl_l3 | 25/30 | 83% | `compass-res-3`_ | +------------------+---------+---------+------------------+ | onos | 28/33 | 84% | `compass-res-4`_ | +------------------+---------+---------+------------------+ -| openo | 28/30 | 93% | `compass-res-5`_ | +| openo | 29/30 | 97% | `compass-res-5`_ | +------------------+---------+---------+------------------+ -| ocl | 4/30 | 13% | `compass-res-6`_ | +| ocl | 3/30 | 10% | `compass-res-6`_ | +------------------+---------+---------+------------------+ Note: all the Compass tests for Danube have been executed on virtual @@ -361,37 +364,37 @@ Fuel | Scenario | Scoring | Success | Results | | | | rate | | +======================+=========+=========+================+ -| nosdn | 37/39 | 95% | `fuel-res-1`_ | +| nosdn | 38/39 | 97% | `fuel-res-1`_ | +----------------------+---------+---------+----------------+ | nosdn-noha | 36/36 | 100% | `fuel-res-2`_ | +----------------------+---------+---------+----------------+ -| nosdn-kvm | 37/39 | 95% | `fuel-res-3`_ | +| nosdn-kvm | 39/39 | 100% | `fuel-res-3`_ | +----------------------+---------+---------+----------------+ | nosdn-kvm-noha | 36/36 | 100% | `fuel-res-4`_ | +----------------------+---------+---------+----------------+ -| nosdn-ovs | 38/39 | 97% | `fuel-res-5`_ | +| nosdn-ovs | 39/39 | 100% | `fuel-res-5`_ | +----------------------+---------+---------+----------------+ | nosdn-ovs-noha | 36/36 | 100% | `fuel-res-6`_ | +----------------------+---------+---------+----------------+ -| odl_l2 | 42/42 | 100% | `fuel-res-7`_ | +| odl_l2 | 40/42 | 95% | `fuel-res-7`_ | +----------------------+---------+---------+----------------+ -| odl_l2-noha | 36/39 | 92% | `fuel-res-8`_ | +| odl_l2-noha | 37/39 | 95% | `fuel-res-8`_ | +----------------------+---------+---------+----------------+ -| odl_l2-sfc | 40/45 | 89% | `fuel-res-11`_ | +| odl_l2-sfc | 45/45 | 100% | `fuel-res-9`_ | +----------------------+---------+---------+----------------+ -| odl_l2-sfc-noha | 36/42 | 86% | `fuel-res-12`_ | +| odl_l2-sfc-noha | 36/42 | 86% | `fuel-res-10`_ | +----------------------+---------+---------+----------------+ -| odl_l3 | 34/39 | 87% | `fuel-res-13`_ | +| odl_l3 | 38/39 | 97% | `fuel-res-11`_ | +----------------------+---------+---------+----------------+ -| odl_l3-noha | 34/36 | 94% | `fuel-res-14`_ | +| odl_l3-noha | 36/36 | 100% | `fuel-res-12`_ | +----------------------+---------+---------+----------------+ -| kvm_ovs_dpdk | 6/39 | 15% | `fuel-res-15`_ | +| kvm_ovs_dpdk | 6/39 | 15% | `fuel-res-13`_ | +----------------------+---------+---------+----------------+ -| kvm_ovs_dpdk_noha | 36/36 | 100% | `fuel-res-16`_ | +| kvm_ovs_dpdk_noha | 36/36 | 100% | `fuel-res-14`_ | +----------------------+---------+---------+----------------+ -| kvm_ovs_dpdk_bar | 6/42 | 14% | `fuel-res-17`_ | +| kvm_ovs_dpdk_bar | 6/42 | 14% | `fuel-res-15`_ | +----------------------+---------+---------+----------------+ -| kvm_ovs_dpdk_bar_noha| 38/39 | 97% | `fuel-res-18`_ | +| kvm_ovs_dpdk_bar_noha| 38/39 | 97% | `fuel-res-16`_ | +----------------------+---------+---------+----------------+ @@ -404,13 +407,13 @@ Joid | Scenario | Scoring | Success | Results | | | | rate | | +=====================+=========+=========+===============+ -| nosdn | 32/33 | 97% | `joid-res-1`_ | +| nosdn | 29/33 | 97% | `joid-res-1`_ | +---------------------+---------+---------+---------------+ -| nosdn-noha | 31/33 | 94% | `joid-res-2`_ | +| nosdn-noha | 33/33 | 100% | `joid-res-2`_ | +---------------------+---------+---------+---------------+ | nosdn-lxd | 18/24 | 75% | `joid-res-3`_ | +---------------------+---------+---------+---------------+ -| nosdn-lxd-noha | 17/24 | 71% | `joid-res-4`_ | +| nosdn-lxd-noha | 18/24 | 71% | `joid-res-4`_ | +---------------------+---------+---------+---------------+ | odl_l2 | 9/36 | 25% | `joid-res-5`_ | +---------------------+---------+---------+---------------+ @@ -495,7 +498,7 @@ Open JIRA tickets All the tickets that are not blocking have been fixed or postponed the next release. -Functest Danube 1.0 is released without known bugs. +Functest Danube 2.0 is released without known bugs. @@ -522,78 +525,75 @@ Useful links .. _`gluon-bug`: https://bugs.opendaylight.org/show_bug.cgi?id=5586 -.. _`apex-res-1`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-68 +.. _`apex-res-1`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-222 -.. _`apex-res-2`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-69 +.. _`apex-res-2`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-211 -.. _`apex-res-3`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-70 +.. _`apex-res-3`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-224 -.. _`apex-res-4`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-66 +.. _`apex-res-4`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-225 -.. _`apex-res-5`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-60 +.. _`apex-res-5`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-216 -.. _`apex-res-6`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-73 +.. _`apex-res-6`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-215 -.. _`apex-res-7`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-72 +.. _`apex-res-7`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-214 -.. _`apex-res-8`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-69 +.. _`apex-res-8`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-217 -.. _`apex-res-9`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-62 +.. _`apex-res-9`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-apex-apex-daily-danube-daily-danube-218 -.. _`compass-res-1`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-compass-virtual-daily-danube-60 +.. _`compass-res-1`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-compass-virtual-daily-danube-216 -.. _`compass-res-2`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-compass-virtual-daily-danube-59 +.. _`compass-res-2`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-compass-virtual-daily-danube-221 -.. _`compass-res-3`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-compass-baremetal-daily-danube-69 +.. _`compass-res-3`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-compass-baremetal-daily-danube-214 -.. _`compass-res-4`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-compass-virtual-daily-danube-57 +.. _`compass-res-4`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-compass-virtual-daily-danube-213 -.. _`compass-res-5`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-compass-baremetal-daily-danube-67 +.. _`compass-res-5`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-compass-baremetal-daily-danube-212 -.. _`compass-res-6`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-compass-baremetal-daily-danube-65 +.. _`compass-res-6`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-compass-baremetal-daily-danube-222 .. _`fuel-res-1`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-baremetal-daily-danube-54 -.. _`fuel-res-2`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-46 +.. _`fuel-res-2`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-357 .. _`fuel-res-3`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-baremetal-daily-danube-53 -.. _`fuel-res-4`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-44 - -.. _`fuel-res-5`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-baremetal-daily-danube-55 +.. _`fuel-res-4`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-355 -.. _`fuel-res-6`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-45 +.. _`fuel-res-5`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-baremetal-daily-danube-335 -.. _`fuel-res-7`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-zte-pod1-daily-danube-4 +.. _`fuel-res-6`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-356 -.. _`fuel-res-8`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-48 +.. _`fuel-res-7`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-zte-pod1-daily-danube-337 -.. _`fuel-res-9`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-baremetal-daily-danube-52 +.. _`fuel-res-8`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-358 -.. _`fuel-res-10`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-43 +.. _`fuel-res-9`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-baremetal-daily-danube-340 -.. _`fuel-res-11`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-baremetal-daily-danube-50 +.. _`fuel-res-10`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-353 -.. _`fuel-res-12`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-42 +.. _`fuel-res-11`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-baremetal-daily-danube-338 -.. _`fuel-res-13`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-baremetal-daily-danube-48 +.. _`fuel-res-12`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-360 -.. _`fuel-res-14`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-50 +.. _`fuel-res-13`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-baremetal-daily-danube-341 -.. _`fuel-res-15`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-baremetal-daily-danube-51 +.. _`fuel-res-14`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-359 -.. _`fuel-res-16`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-49 +.. _`fuel-res-15`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-baremetal-daily-danube-339 -.. _`fuel-res-17`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-baremetal-daily-danube-49 +.. _`fuel-res-16`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-fuel-virtual-daily-danube-361 -.. _`fuel-res-18`: http://testresults.opnfv.org/test/api/v1/results?build_tag= jenkins-functest-fuel-virtual-daily-danube-51 -.. _`joid-res-1`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-joid-baremetal-daily-danube-54 +.. _`joid-res-1`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-joid-baremetal-daily-danube-164 -.. _`joid-res-2`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-joid-baremetal-daily-danube-55 +.. _`joid-res-2`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-joid-baremetal-daily-danube-150 -.. _`joid-res-3`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-joid-baremetal-daily-danube-56 +.. _`joid-res-3`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-joid-baremetal-daily-danube-162 -.. _`joid-res-4`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-joid-baremetal-daily-danube-57 +.. _`joid-res-4`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-joid-baremetal-daily-danube-167 -.. _`joid-res-5`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-joid-baremetal-daily-danube-46 +.. _`joid-res-5`: http://testresults.opnfv.org/test/api/v1/results?build_tag=jenkins-functest-joid-baremetal-daily-danube-165 diff --git a/docs/release/release-notes/index.rst b/docs/release/release-notes/index.rst index a1a2aa1a7..d0ad9bde5 100644 --- a/docs/release/release-notes/index.rst +++ b/docs/release/release-notes/index.rst @@ -15,6 +15,6 @@ Functest Release Notes Revision: _sha1_ -:Author: Morgan Richomme (morgan.richomme@orange.com) +:Author: Jose Lausuch (jose.lausuch@ericsson.com) Build date: |today| diff --git a/docs/testing/user/configguide/configguide.rst b/docs/testing/user/configguide/configguide.rst index 5c89cf0e6..35548c9b2 100644 --- a/docs/testing/user/configguide/configguide.rst +++ b/docs/testing/user/configguide/configguide.rst @@ -11,14 +11,15 @@ following docker command:: docker pull opnfv/functest:<TagIdentifier> where <TagIdentifier> identifies a release of the Functest docker -container image in the public dockerhub registry. There are many tags +container image in the public Dockerhub registry. There are many tags created automatically by the CI mechanisms, and you must ensure you pull an image with the **correct tag** to match the OPNFV software release installed in your environment. All available tagged images can be seen from location [FunctestDockerTags_]. For example, when running on the first official release of the OPNFV Danube system platform, -tag "danube.1.0" is needed. Pulling other tags might cause some -problems while running the tests. +tag "danube.1.0" is needed. For the second and third releases, the tag +"danube.2.0" and "danube.3.0" can be used respectively. +Pulling other tags might cause some problems while running the tests. Docker images pulled without a tag specifier bear the implicitly assigned label "latest". If you need to specifically pull the latest Functest docker image, then omit the tag argument:: @@ -29,10 +30,10 @@ After pulling the Docker image, check that it is available with the following docker command:: [functester@jumphost ~]$ docker images - REPOSITORY TAG IMAGE ID CREATED SIZE - opnfv/functest latest 8cd6683c32ae 2 weeks ago 1.321 GB - opnfv/functest danube.1.0 13fa54a1b238 4 weeks ago 1.29 GB - opnfv/functest colorado.1.0 94b78faa94f7 9 weeks ago 968 MB + REPOSITORY TAG IMAGE ID CREATED SIZE + opnfv/functest latest 8cd6683c32ae 2 weeks ago 1.321 GB + opnfv/functest danube.2.0 d2c174a91911 7 minutes ago 1.471 GB + opnfv/functest danube.1.0 13fa54a1b238 4 weeks ago 1.29 GB The Functest docker container environment can -in principle- be also used with non-OPNFV official installers (e.g. 'devstack'), with the @@ -361,7 +362,7 @@ follows:: |-- __init__.py |-- ci | |-- __init__.py - | |-- check_os.sh + | |-- check_deployment.py | |-- config_functest.yaml | |-- config_patch.yaml | |-- generate_report.py diff --git a/functest/ci/check_deployment.py b/functest/ci/check_deployment.py new file mode 100644 index 000000000..fe20dc8f1 --- /dev/null +++ b/functest/ci/check_deployment.py @@ -0,0 +1,163 @@ +#!/usr/bin/env python + +# Copyright (c) 2017 Ericsson and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 + +""" +OpenStack deployment checker + +Verifies that: + - Credentials file is given and contains the right information + - OpenStack endpoints are reachable +""" + +import logging +import logging.config +import os +import pkg_resources +import socket +import time +from urlparse import urlparse + +from snaps.openstack.utils import glance_utils +from snaps.openstack.utils import keystone_utils +from snaps.openstack.utils import neutron_utils +from snaps.openstack.utils import nova_utils +from snaps.openstack.tests import openstack_tests + +__author__ = "Jose Lausuch <jose.lausuch@ericsson.com>" + +LOGGER = logging.getLogger(__name__) + + +def verify_connectivity(adress, port, timeout=10): + """ Returns true if an ip/port is reachable""" + connection = socket.socket() + count = 0 + while count < timeout: + try: + connection.connect((adress, port)) + LOGGER.debug('%s:%s is reachable!', adress, port) + return True + except socket.error: + count += 1 + time.sleep(1) + continue + LOGGER.error('%s:%s is not reachable.', adress, port) + return False + + +class CheckDeployment(object): + """ Check deployment class.""" + + def __init__(self, rc_file='/home/opnfv/functest/conf/openstack.creds'): + self.rc_file = rc_file + self.services = ('compute', 'network', 'image') + self.os_creds = None + + def check_rc(self): + """ Check if RC file exists and contains OS_AUTH_URL """ + if not os.path.isfile(self.rc_file): + raise IOError('RC file {} does not exist!'.format(self.rc_file)) + if 'OS_AUTH_URL' not in open(self.rc_file).read(): + raise SyntaxError('OS_AUTH_URL not defined in {}.'. + format(self.rc_file)) + + def check_auth_endpoint(self): + """ Verifies connectivity to the OS_AUTH_URL given in the RC file """ + rc_endpoint = self.os_creds.auth_url + if not (verify_connectivity(urlparse(rc_endpoint).hostname, + urlparse(rc_endpoint).port)): + raise Exception("OS_AUTH_URL {} is not reachable.". + format(rc_endpoint)) + LOGGER.info("Connectivity to OS_AUTH_URL %s ...OK", rc_endpoint) + + def check_public_endpoint(self): + """ Gets the public endpoint and verifies connectivity to it """ + public_endpoint = keystone_utils.get_endpoint(self.os_creds, + 'identity', + interface='public') + if not (verify_connectivity(urlparse(public_endpoint).hostname, + urlparse(public_endpoint).port)): + raise Exception("Public endpoint {} is not reachable.". + format(public_endpoint)) + LOGGER.info("Connectivity to the public endpoint %s ...OK", + public_endpoint) + + def check_service_endpoint(self, service): + """ Verifies connectivity to a given openstack service """ + endpoint = keystone_utils.get_endpoint(self.os_creds, + service, + interface='public') + if not (verify_connectivity(urlparse(endpoint).hostname, + urlparse(endpoint).port)): + raise Exception("{} endpoint {} is not reachable.". + format(service, endpoint)) + LOGGER.info("Connectivity to endpoint '%s' %s ...OK", + service, endpoint) + + def check_nova(self): + """ checks that a simple nova operation works """ + try: + client = nova_utils.nova_client(self.os_creds) + client.servers.list() + LOGGER.info("Nova service ...OK") + except Exception as error: + LOGGER.error("Nova service ...FAILED") + raise error + + def check_neutron(self): + """ checks that a simple neutron operation works """ + try: + client = neutron_utils.neutron_client(self.os_creds) + client.list_networks() + LOGGER.info("Neutron service ...OK") + except Exception as error: + LOGGER.error("Neutron service ...FAILED") + raise error + + def check_glance(self): + """ checks that a simple glance operation works """ + try: + client = glance_utils.glance_client(self.os_creds) + client.images.list() + LOGGER.info("Glance service ...OK") + except Exception as error: + LOGGER.error("Glance service ...FAILED") + raise error + + def check_all(self): + """ + Calls all the class functions and returns 0 if all of them succeed. + This is the method called by prepare_env or CLI + """ + self.check_rc() + try: + self.os_creds = openstack_tests.get_credentials( + os_env_file=self.rc_file, + proxy_settings_str=None, + ssh_proxy_cmd=None) + except: + raise Exception("Problem while getting credentials object.") + if self.os_creds is None: + raise Exception("Credentials is None.") + self.check_auth_endpoint() + self.check_public_endpoint() + for service in self.services: + self.check_service_endpoint(service) + self.check_nova() + self.check_neutron() + self.check_glance() + return 0 + + +def main(): + """Entry point""" + logging.config.fileConfig(pkg_resources.resource_filename( + 'functest', 'ci/logging.ini')) + deployment = CheckDeployment() + return deployment.check_all() diff --git a/functest/ci/check_os.sh b/functest/ci/check_os.sh deleted file mode 100644 index 7b66f3da6..000000000 --- a/functest/ci/check_os.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# -# Simple script to check the basic OpenStack clients -# -# Author: -# jose.lausuch@ericsson.com -# - -if [[ ${OS_INSECURE,,} == "true" ]]; then - options='--insecure' -else - options='' -fi - -declare -A service_cmd_array -service_cmd_array['nova']="openstack $options server list" -service_cmd_array['neutron']="openstack $options network list" -service_cmd_array['keystone']="openstack $options endpoint list" -service_cmd_array['cinder']="openstack $options volume list" -service_cmd_array['glance']="openstack $options image list" - -MANDATORY_SERVICES='nova neutron keystone glance' -OPTIONAL_SERVICES='cinder' - -verify_connectivity() { - for i in $(seq 0 9); do - if echo "test" | nc -v -w 10 $1 $2 &>/dev/null; then - return 0 - fi - sleep 1 - done - return 1 -} - -verify_SSL_connectivity() { - openssl s_client -connect $1:$2 &>/dev/null - return $? -} - -check_service() { - local service cmd - service=$1 - cmd=${service_cmd_array[$service]} - if [ -z "$2" ]; then - required='false' - else - required=$2 - fi - echo ">>Checking ${service} service..." - if ! openstack $options service list | grep -i ${service} > /dev/null; then - if [ "$required" == 'false' ]; then - echo "WARN: Optional Service ${service} is not enabled!" - return - else - echo "ERROR: Required Service ${service} is not enabled!" - exit 1 - fi - fi - $cmd &>/dev/null - result=$? - if [ $result -ne 0 ]; then - echo "ERROR: Failed execution $cmd. The $service does not seem to be working." - exit 1 - else - echo " ...OK" - fi -} - -if [ -z $OS_AUTH_URL ];then - echo "ERROR: OS_AUTH_URL environment variable missing... Have you sourced the OpenStack credentials?" - exit 1 -fi - - -echo "Checking OpenStack endpoints:" -publicURL=$(openstack $options catalog show identity |awk '/public/ {print $4}') -publicIP=$(echo $publicURL|sed 's/^.*http.*\:\/\///'|sed 's/.[^:]*$//') -publicPort=$(echo $publicURL|grep -Po '(?<=:)\d+') -https_enabled=$(echo $publicURL | grep 'https') -if [[ -n $https_enabled ]]; then - echo ">>Verifying SSL connectivity to the public endpoint $publicIP:$publicPort..." - verify_SSL_connectivity $publicIP $publicPort -else - echo ">>Verifying connectivity to the public endpoint $publicIP:$publicPort..." - verify_connectivity $publicIP $publicPort -fi -RETVAL=$? -if [ $RETVAL -ne 0 ]; then - echo "ERROR: Cannot talk to the public endpoint $publicIP:$publicPort ." - echo "OS_AUTH_URL=$OS_AUTH_URL" - exit 1 -fi -echo " ...OK" - - -echo "Checking Required OpenStack services:" -for service in $MANDATORY_SERVICES; do - check_service $service "true" -done -echo "Required OpenStack services are OK." - -echo "Checking Optional OpenStack services:" -for service in $OPTIONAL_SERVICES; do - check_service $service -done - -echo "Checking External network..." -networks=($(neutron $options net-list -F id | tail -n +4 | head -n -1 | awk '{print $2}')) -is_external=False -for net in "${networks[@]}" -do - is_external=$(neutron $options net-show $net|grep "router:external"|awk '{print $4}') - if [ $is_external == "True" ]; then - echo "External network found: $net" - break - fi -done -if [ $is_external == "False" ]; then - echo "ERROR: There are no external networks in the deployment." - exit 1 -fi - -exit 0 diff --git a/functest/ci/prepare_env.py b/functest/ci/prepare_env.py index da3e62450..c40e32660 100644 --- a/functest/ci/prepare_env.py +++ b/functest/ci/prepare_env.py @@ -19,6 +19,7 @@ import fileinput import yaml +from functest.ci import check_deployment import functest.utils.functest_utils as ft_utils import functest.utils.openstack_utils as os_utils from functest.utils.constants import CONST @@ -177,26 +178,6 @@ def create_directories(): def source_rc_file(): print_separator() - if CONST.__getattribute__('openstack_creds') is None: - logger.warning("The environment variable 'creds' must be set and" - "pointing to the local RC file. Using default: " - "/home/opnfv/functest/conf/openstack.creds ...") - os.path.join( - CONST.__getattribute__('dir_functest_conf'), 'openstack.creds') - - if not os.path.isfile(CONST.__getattribute__('openstack_creds')): - raise Exception( - "OpenStack credentials file not provided. " - "The OpenStack credentials must be in {}" - .format(CONST.__getattribute__('openstack_creds'))) - else: - logger.info("RC file provided in %s." - % CONST.__getattribute__('openstack_creds')) - if os.path.getsize(CONST.__getattribute__('openstack_creds')) == 0: - raise Exception( - "The OpenStack RC file {} is empty." - .format(CONST.__getattribute__('openstack_creds'))) - logger.info("Sourcing the OpenStack RC file...") os_utils.source_credentials(CONST.__getattribute__('openstack_creds')) for key, value in os.environ.iteritems(): @@ -250,18 +231,9 @@ def update_db_url(): def verify_deployment(): print_separator() - logger.info("Verifying OpenStack services...") - cmd = "check_os.sh" - - logger.debug("Executing command: %s" % cmd) - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) - - while p.poll() is None: - line = p.stdout.readline().rstrip() - if "ERROR" in line: - logger.error(line) - raise Exception("Problem while running '{}'.".format(cmd)) - logger.info(line) + logger.info("Verifying OpenStack deployment...") + deployment = check_deployment.CheckDeployment() + deployment.check_all() def install_rally(): @@ -364,11 +336,11 @@ def prepare_env(**kwargs): return -1 elif kwargs['action'] == "start": logger.info("######### Preparing Functest environment #########\n") + verify_deployment() check_env_variables() create_directories() source_rc_file() update_config_file() - verify_deployment() install_rally() install_tempest() create_flavor() diff --git a/functest/cli/commands/cli_os.py b/functest/cli/commands/cli_os.py index 44181d4f0..f4ec16615 100644 --- a/functest/cli/commands/cli_os.py +++ b/functest/cli/commands/cli_os.py @@ -12,8 +12,8 @@ import os import click +from functest.ci import check_deployment from functest.utils.constants import CONST -import functest.utils.functest_utils as ft_utils import functest.utils.openstack_clean as os_clean import functest.utils.openstack_snapshot as os_snapshot @@ -49,7 +49,8 @@ class CliOpenStack(object): def check(self): self.ping_endpoint() - ft_utils.execute_command("check_os.sh", verbose=False) + deployment = check_deployment.CheckDeployment() + deployment.check_all() def snapshot_create(self): self.ping_endpoint() diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py index 67bf66e34..ede0fc500 100644 --- a/functest/opnfv_tests/sdn/odl/odl.py +++ b/functest/opnfv_tests/sdn/odl/odl.py @@ -235,6 +235,10 @@ class ODLTests(testcase.TestCase): kwargs['odlip'] = os.environ['SDN_CONTROLLER'] elif installer_type == 'compass': kwargs['odlwebport'] = '8181' + elif installer_type == 'daisy': + kwargs['odlip'] = os.environ['SDN_CONTROLLER_IP'] + kwargs['odlwebport'] = '8181' + kwargs['odlrestconfport'] = '8087' else: kwargs['odlip'] = os.environ['SDN_CONTROLLER_IP'] except KeyError as ex: diff --git a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py index 25ddca216..5a5c12bee 100644 --- a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py +++ b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py @@ -43,7 +43,7 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding): def config_ellis(self, ellis_ip, signup_code='secret', two_numbers=False): output_dict = {} - self.logger.info('Configure Ellis: %s', ellis_ip) + self.logger.debug('Configure Ellis: %s', ellis_ip) output_dict['ellis_ip'] = ellis_ip account_url = 'http://{0}/accounts'.format(ellis_ip) params = {"password": "functest", @@ -54,7 +54,7 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding): output_dict['login'] = params if rq.status_code != 201 and rq.status_code != 409: raise Exception("Unable to create an account for number provision") - self.logger.info('Account is created on Ellis: %s', params) + self.logger.debug('Account is created on Ellis: %s', params) session_url = 'http://{0}/session'.format(ellis_ip) session_data = { @@ -66,13 +66,13 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding): if rq.status_code != 201: raise Exception('Failed to get cookie for Ellis') cookies = rq.cookies - self.logger.info('Cookies: %s', cookies) + self.logger.debug('Cookies: %s', cookies) number_url = 'http://{0}/accounts/{1}/numbers'.format( ellis_ip, params['email']) - self.logger.info('Create 1st calling number on Ellis') - i = 24 + self.logger.debug('Create 1st calling number on Ellis') + i = 30 while rq.status_code != 200 and i > 0: try: number_res = self.create_ellis_number(number_url, cookies) @@ -86,7 +86,7 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding): output_dict['number'] = number_res if two_numbers: - self.logger.info('Create 2nd calling number on Ellis') + self.logger.debug('Create 2nd calling number on Ellis') number_res = self.create_ellis_number(number_url, cookies) output_dict['number2'] = number_res @@ -131,7 +131,7 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding): script = '{0}{1}'.format(script, subscript) script = ('{0}{1}'.format(script, ' --trace')) cmd = "/bin/bash -c '{0}'".format(script) - self.logger.info('Live test cmd: %s', cmd) + self.logger.debug('Live test cmd: %s', cmd) output_file = os.path.join(self.result_dir, "ims_test_output.txt") ft_utils.execute_command(cmd, error_msg='Clearwater live test failed', diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py index fafc77e13..8f6fcec89 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016 Orange and others. +# Copyright (c) 2017 Orange and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -25,16 +25,16 @@ from functest.utils.constants import CONST import functest.utils.openstack_utils as os_utils from snaps.openstack.os_credentials import OSCreds -from snaps.openstack.create_network import NetworkSettings, SubnetSettings, \ - OpenStackNetwork -from snaps.openstack.create_security_group import SecurityGroupSettings, \ - SecurityGroupRuleSettings,\ - Direction, Protocol, \ - OpenStackSecurityGroup +from snaps.openstack.create_network import (NetworkSettings, SubnetSettings, + OpenStackNetwork) +from snaps.openstack.create_security_group import (SecurityGroupSettings, + SecurityGroupRuleSettings, + Direction, Protocol, + OpenStackSecurityGroup) from snaps.openstack.create_router import RouterSettings, OpenStackRouter -from snaps.openstack.create_instance import VmInstanceSettings, \ - FloatingIpSettings, \ - OpenStackVmInstance +from snaps.openstack.create_instance import (VmInstanceSettings, + FloatingIpSettings, + OpenStackVmInstance) from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor from snaps.openstack.create_image import ImageSettings, OpenStackImage from snaps.openstack.create_keypairs import KeypairSettings, OpenStackKeypair @@ -239,6 +239,8 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): while str(cfy_status) != 'running' and retry: try: cfy_status = cfy_client.manager.get_status()['status'] + self.__logger.debug("The current manager status is %s", + cfy_status) except Exception: # pylint: disable=broad-except self.__logger.warning("Cloudify Manager isn't " + "up and running. Retrying ...") @@ -263,14 +265,15 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): self.__logger.info("Put private keypair in manager") if manager_creator.vm_ssh_active(block=True): ssh = manager_creator.ssh_client() - scp = SCPClient(ssh.get_transport()) + scp = SCPClient(ssh.get_transport(), socket_timeout=15.0) scp.put(kp_file, '~/') cmd = "sudo cp ~/cloudify_ims.pem /etc/cloudify/" - ssh.exec_command(cmd) + run_blocking_ssh_command(ssh, cmd) cmd = "sudo chmod 444 /etc/cloudify/cloudify_ims.pem" - ssh.exec_command(cmd) + run_blocking_ssh_command(ssh, cmd) cmd = "sudo yum install -y gcc python-devel" - ssh.exec_command(cmd) + run_blocking_ssh_command(ssh, cmd, "Unable to install packages \ + on manager") self.details['orchestrator'].update(status='PASS', duration=duration) @@ -292,15 +295,17 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): descriptor.get('file_name')) self.__logger.info("Get or create flavor for all clearwater vm") - self.exist_obj['flavor2'], flavor_id = os_utils.get_or_create_flavor( - self.vnf['requirements']['flavor']['name'], - self.vnf['requirements']['flavor']['ram_min'], - '30', - '1', - public=True) + flavor_settings = FlavorSettings( + name=self.vnf['requirements']['flavor']['name'], + ram=self.vnf['requirements']['flavor']['ram_min'], + disk=25, + vcpus=1) + flavor_creator = OpenStackFlavor(self.snaps_creds, flavor_settings) + flavor_creator.create() + self.created_object.append(flavor_creator) self.vnf['inputs'].update(dict( - flavor_id=flavor_id, + flavor_id=self.vnf['requirements']['flavor']['name'], )) self.__logger.info("Create VNF Instance") @@ -371,7 +376,7 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): try: cfy_client.executions.cancel(execution['id'], force=True) - except: + except: # pylint: disable=broad-except self.__logger.warn("Can't cancel the current exec") execution = cfy_client.executions.start( @@ -383,7 +388,7 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): wait_for_execution(cfy_client, execution, self.__logger) cfy_client.deployments.delete(self.vnf['descriptor'].get('name')) cfy_client.blueprints.delete(self.vnf['descriptor'].get('name')) - except: + except: # pylint: disable=broad-except self.__logger.warn("Some issue during the undeployment ..") self.__logger.warn("Tenant clean continue ..") @@ -507,3 +512,10 @@ def sig_test_format(sig_test): total_sig_test_result['failures'] = nb_failures total_sig_test_result['skipped'] = nb_skipped return total_sig_test_result + + +def run_blocking_ssh_command(ssh, cmd, error_msg="Unable to run this command"): + """Command to run ssh command with the exit status.""" + stdin, stdout, stderr = ssh.exec_command(cmd) + if stdout.channel.recv_exit_status() != 0: + raise Exception(error_msg) diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml b/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml index f1028ce73..743c6ddd8 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml @@ -19,7 +19,7 @@ vnf: version: '122' requirements: flavor: - name: m1.medium + name: m1.small ram_min: 2048 inputs: image_id: 'ubuntu_14.04' diff --git a/functest/tests/unit/ci/test_check_deployment.py b/functest/tests/unit/ci/test_check_deployment.py new file mode 100644 index 000000000..1f44d0787 --- /dev/null +++ b/functest/tests/unit/ci/test_check_deployment.py @@ -0,0 +1,176 @@ +#!/usr/bin/env python + +# Copyright (c) 2017 Ericsson and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 + +import logging +import mock +import unittest + +from functest.ci import check_deployment + +__author__ = "Jose Lausuch <jose.lausuch@ericsson.com>" + + +class CheckDeploymentTesting(unittest.TestCase): + """The super class which testing classes could inherit.""" + # pylint: disable=missing-docstring + + logging.disable(logging.CRITICAL) + + def setUp(self): + self.client_test = mock.Mock() + self.deployment = check_deployment.CheckDeployment() + self.service_test = 'compute' + self.rc_file = self.deployment.rc_file + self.endpoint_test = 'http://192.168.0.6:5000/v3' + creds_attr = {'auth_url': self.endpoint_test, + 'proxy_settings': ''} + proxy_attr = {'host': '192.168.0.1', 'port': '5000'} + proxy_settings = mock.Mock() + proxy_settings.configure_mock(**proxy_attr) + self.os_creds = mock.Mock() + self.os_creds.configure_mock(**creds_attr) + self.os_creds.proxy_settings = proxy_settings + self.deployment.os_creds = self.os_creds + + def test_check_rc(self): + with mock.patch('functest.ci.check_deployment.os.path.isfile', + returns=True) as m, \ + mock.patch('__builtin__.open', + mock.mock_open(read_data='OS_AUTH_URL')): + self.deployment.check_rc() + self.assertTrue(m.called) + + def test_check_rc_missing_file(self): + with mock.patch('functest.ci.check_deployment.os.path.isfile', + return_value=False), \ + self.assertRaises(Exception) as context: + msg = 'RC file {} does not exist!'.format(self.rc_file) + self.deployment.check_rc(self.rc_file) + self.assertTrue(msg in context) + + def test_check_rc_missing_os_auth(self): + with mock.patch('__builtin__.open', + mock.mock_open(read_data='test')), \ + self.assertRaises(Exception) as context: + msg = 'OS_AUTH_URL not defined in {}.'.format(self.rc_file) + self.assertTrue(msg in context) + + def test_check_auth_endpoint(self): + with mock.patch('functest.ci.check_deployment.verify_connectivity', + return_value=True) as m: + self.deployment.check_auth_endpoint() + self.assertTrue(m.called) + + def test_check_auth_endpoint_not_reachable(self): + with mock.patch('functest.ci.check_deployment.verify_connectivity', + return_value=False) as m, \ + self.assertRaises(Exception) as context: + endpoint = self.os_creds.auth_url + self.deployment.check_auth_endpoint() + msg = "OS_AUTH_URL {} is not reachable.".format(endpoint) + self.assertTrue(m.called) + self.assertTrue(msg in context) + + def test_check_public_endpoint(self): + with mock.patch('functest.ci.check_deployment.verify_connectivity', + return_value=True) as m, \ + mock.patch('functest.ci.check_deployment.keystone_utils.' + 'get_endpoint') as n: + self.deployment.check_public_endpoint() + self.assertTrue(m.called) + self.assertTrue(n.called) + + def test_check_public_endpoint_not_reachable(self): + with mock.patch('functest.ci.check_deployment.verify_connectivity', + return_value=False) as m, \ + mock.patch('functest.ci.check_deployment.keystone_utils.' + 'get_endpoint', + return_value=self.endpoint_test) as n, \ + self.assertRaises(Exception) as context: + self.deployment.check_public_endpoint() + msg = ("Public endpoint {} is not reachable." + .format(self.mock_endpoint)) + self.assertTrue(m.called) + self.assertTrue(n.called) + self.assertTrue(msg in context) + + def test_check_service_endpoint(self): + with mock.patch('functest.ci.check_deployment.verify_connectivity', + return_value=True) as m, \ + mock.patch('functest.ci.check_deployment.keystone_utils.' + 'get_endpoint') as n: + self.deployment.check_service_endpoint(self.service_test) + self.assertTrue(m.called) + self.assertTrue(n.called) + + def test_check_service_endpoint_not_reachable(self): + with mock.patch('functest.ci.check_deployment.verify_connectivity', + return_value=False) as m, \ + mock.patch('functest.ci.check_deployment.keystone_utils.' + 'get_endpoint', + return_value=self.endpoint_test) as n, \ + self.assertRaises(Exception) as context: + self.deployment.check_service_endpoint(self.service_test) + msg = "{} endpoint {} is not reachable.".format(self.service_test, + self.endpoint_test) + self.assertTrue(m.called) + self.assertTrue(n.called) + self.assertTrue(msg in context) + + def test_check_nova(self): + with mock.patch('functest.ci.check_deployment.nova_utils.nova_client', + return_value=self.client_test) as m: + self.deployment.check_nova() + self.assertTrue(m.called) + + def test_check_nova_fail(self): + with mock.patch('functest.ci.check_deployment.nova_utils.nova_client', + return_value=self.client_test) as m, \ + mock.patch.object(self.client_test, 'servers.list', + side_effect=Exception): + self.deployment.check_nova() + self.assertTrue(m.called) + self.assertRaises(Exception) + + def test_check_neutron(self): + with mock.patch('functest.ci.check_deployment.neutron_utils.' + 'neutron_client', return_value=self.client_test) as m: + self.deployment.check_neutron() + self.assertTrue(m.called) + + def test_check_neutron_fail(self): + with mock.patch('functest.ci.check_deployment.neutron_utils.' + 'neutron_client', + return_value=self.client_test) as m, \ + mock.patch.object(self.client_test, 'list_networks', + side_effect=Exception), \ + self.assertRaises(Exception): + self.deployment.check_neutron() + self.assertRaises(Exception) + self.assertTrue(m.called) + + def test_check_glance(self): + with mock.patch('functest.ci.check_deployment.glance_utils.' + 'glance_client', return_value=self.client_test) as m: + self.deployment.check_glance() + self.assertTrue(m.called) + + def test_check_glance_fail(self): + with mock.patch('functest.ci.check_deployment.glance_utils.' + 'glance_client', return_value=self.client_test) as m, \ + mock.patch.object(self.client_test, 'images.list', + side_effect=Exception): + self.deployment.check_glance() + self.assertRaises(Exception) + self.assertTrue(m.called) + + +if __name__ == "__main__": + logging.disable(logging.CRITICAL) + unittest.main(verbosity=2) diff --git a/functest/tests/unit/ci/test_prepare_env.py b/functest/tests/unit/ci/test_prepare_env.py index 7d4b5fb25..7d5fa5645 100644 --- a/functest/tests/unit/ci/test_prepare_env.py +++ b/functest/tests/unit/ci/test_prepare_env.py @@ -309,22 +309,18 @@ class PrepareEnvTesting(unittest.TestCase): prepare_env.update_config_file() self.assertTrue(mock_db_url.called) - @mock.patch('functest.ci.prepare_env.logger.info') - def test_verify_deployment_error(self, mock_logger_error): - mock_popen = mock.Mock() - attrs = {'poll.return_value': None, - 'stdout.readline.return_value': 'ERROR'} - mock_popen.configure_mock(**attrs) + def test_verify_deployment(self): + with mock.patch('functest.ci.check_deployment.CheckDeployment') \ + as mock_check_deployment: + prepare_env.verify_deployment() + self.assertTrue(mock_check_deployment.called) - with mock.patch('functest.ci.prepare_env.print_separator') as m, \ - mock.patch('functest.ci.prepare_env.subprocess.Popen', - return_value=mock_popen), \ - self.assertRaises(Exception) as context: + def test_verify_deployment_error(self): + with mock.patch('functest.ci.prepare_env.' + 'check_deployment.CheckDeployment', + return_value=('test_', None)), \ + self.assertRaises(Exception): prepare_env.verify_deployment() - self.assertTrue(m.called) - msg = "Problem while running 'check_os.sh'." - mock_logger_error.assert_called_once_with('ERROR') - self.assertTrue(msg in context) def _get_rally_creds(self): return {"type": "ExistingCloud", diff --git a/functest/tests/unit/cli/commands/test_cli_os.py b/functest/tests/unit/cli/commands/test_cli_os.py index a3d930de7..806bc9312 100644 --- a/functest/tests/unit/cli/commands/test_cli_os.py +++ b/functest/tests/unit/cli/commands/test_cli_os.py @@ -59,12 +59,12 @@ class CliOpenStackTesting(unittest.TestCase): self.endpoint_ip) mock_exit.assert_called_once_with(0) - @mock.patch('functest.cli.commands.cli_os.ft_utils.execute_command') - def test_check(self, mock_ftutils_execute): - with mock.patch.object(self.cli_os, 'ping_endpoint'): + def test_check(self): + with mock.patch.object(self.cli_os, 'ping_endpoint'), \ + mock.patch('functest.cli.commands.cli_os.check_deployment.' + 'CheckDeployment') as mock_check_deployment: self.cli_os.check() - mock_ftutils_execute.assert_called_once_with( - "check_os.sh", verbose=False) + self.assertTrue(mock_check_deployment.called) @mock.patch('functest.cli.commands.cli_os.os.path.isfile', return_value=False) diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py index 070a8d2ec..8c8a6cec3 100644 --- a/functest/tests/unit/odl/test_odl.py +++ b/functest/tests/unit/odl/test_odl.py @@ -513,6 +513,21 @@ class ODLRunTesting(ODLTesting): self._test_run(testcase.TestCase.EX_OK, odlip=self._neutron_ip, odlwebport='8181') + def test_daisy_no_controller_ip(self): + with mock.patch('functest.utils.openstack_utils.get_endpoint', + return_value="http://{}:9696".format( + ODLTesting._neutron_ip)): + os.environ["INSTALLER_TYPE"] = "daisy" + self.assertEqual(self.test.run(), + testcase.TestCase.EX_RUN_ERROR) + + def test_daisy(self): + os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip + os.environ["INSTALLER_TYPE"] = "daisy" + self._test_run(testcase.TestCase.EX_OK, + odlip=self._sdn_controller_ip, odlwebport='8181', + odlrestconfport='8087') + class ODLArgParserTesting(ODLTesting): @@ -10,7 +10,6 @@ scripts = docker/add_images.sh docker/config_install_env.sh functest/ci/download_images.sh - functest/ci/check_os.sh [entry_points] console_scripts = @@ -23,3 +22,4 @@ console_scripts = openstack_clean = functest.utils.openstack_clean:main prepare_env = functest.ci.prepare_env:main run_tests = functest.ci.run_tests:main + check_deployment = functest.ci.check_deployment:main |