diff options
47 files changed, 276 insertions, 177 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..78668cf6a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "docs/com/pres/reveal.js"] + path = docs/com/pres/reveal.js + url = https://github.com/hakimel/reveal.js.git diff --git a/docker/Dockerfile b/docker/Dockerfile index 30c31dad3..4c0995b97 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -120,8 +120,20 @@ 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 + -not -path "*tests/unit*" \ + -not -path "*functest_venv*" \ + |xargs grep -L __main__ |cut -d\: -f 1 |xargs chmod -c 644 \ + && find ${FUNCTEST_REPO_DIR} -name "*.sh" \ + -not -path "*functest_venv*" \ + |xargs grep -L \#\! |cut -d\: -f 1 |xargs chmod -c 644 + +RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \ + -not -path "*tests/unit*" \ + -not -path "*functest_venv*" \ + |xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755 \ + && find ${FUNCTEST_REPO_DIR} -name "*.sh" \ + -not -path "*functest_venv*" \ + |xargs grep \#\! |cut -d\: -f 1 |xargs chmod -c 755 RUN /bin/bash ${REPOS_DIR}/parser/tests/parser_install.sh ${REPOS_DIR} RUN ${REPOS_DIR}/rally/install_rally.sh --yes @@ -144,6 +156,7 @@ RUN cd ${REPOS_DIR}/bgpvpn && pip install -e . # Kingbird integration RUN cd ${REPOS_DIR}/kingbird && pip install -e . +RUN cd ${FUNCTEST_REPO_DIR} && pip install -r kingbird_requirements.txt # refstack-client integration RUN cd ${REPOS_DIR}/refstack-client && ./setup_env -t ${REFSTACK_TAG} diff --git a/docker/Dockerfile.aarch64 b/docker/Dockerfile.aarch64 index 15f0bdc3a..17bf00027 100644 --- a/docker/Dockerfile.aarch64 +++ b/docker/Dockerfile.aarch64 @@ -112,8 +112,20 @@ RUN cd ${RELENG_MODULE_DIR} \ && pip install -e . 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 + -not -path "*tests/unit*" \ + -not -path "*functest_venv*" \ + |xargs grep -L __main__ |cut -d\: -f 1 |xargs chmod -c 644 \ + && find ${FUNCTEST_REPO_DIR} -name "*.sh" \ + -not -path "*functest_venv*" \ + |xargs grep -L \#\! |cut -d\: -f 1 |xargs chmod -c 644 + +RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \ + -not -path "*tests/unit*" \ + -not -path "*functest_venv*" \ + |xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755 \ + && find ${FUNCTEST_REPO_DIR} -name "*.sh" \ + -not -path "*functest_venv*" \ + |xargs grep \#\! |cut -d\: -f 1 |xargs chmod -c 755 RUN /bin/bash ${REPOS_DIR}/parser/tests/parser_install.sh ${REPOS_DIR} RUN ${REPOS_DIR}/rally/install_rally.sh --yes diff --git a/docs/com/README.txt b/docs/com/README.txt deleted file mode 100644 index 62d616b49..000000000 --- a/docs/com/README.txt +++ /dev/null @@ -1,9 +0,0 @@ -This com folder contains the images, html and css files used to create -communication based on reveal.js -All the files are licensed under Creative Commons Attribution 4.0 -International License. -.. http://creativecommons.org/licenses/by/4.0 - -You can download reveal.js at: https://github.com/hakimel/reveal.js/ -Then you must put images and css on existing directory and add the pres -directory diff --git a/docs/com/pres/Summit/Berlin-2016/conversation.html b/docs/com/pres/Summit/Berlin-2016/conversation.html index b56b1e100..356c2ad1e 100755 --- a/docs/com/pres/Summit/Berlin-2016/conversation.html +++ b/docs/com/pres/Summit/Berlin-2016/conversation.html @@ -14,18 +14,18 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui"> - <link rel="stylesheet" href="../../../css/reveal.css"> + <link rel="stylesheet" href="../../reveal.js/css/reveal.css"> <link rel="stylesheet" href="../../../css/theme/OPNFV-Berlin.css" id="theme"> <!-- Code syntax highlighting --> - <link rel="stylesheet" href="../../../lib/css/zenburn.css"> + <link rel="stylesheet" href="../../reveal.js/lib/css/zenburn.css"> <!-- Printing and PDF exports --> <script> var link = document.createElement( 'link' ); link.rel = 'stylesheet'; link.type = 'text/css'; - link.href = window.location.search.match( /print-pdf/gi ) ? '../../../css/print/pdf.css' : '../../../css/print/paper.css'; + link.href = window.location.search.match( /print-pdf/gi ) ? '../../reveal.js/css/print/pdf.css' : '../../reveal.js/css/print/paper.css'; document.getElementsByTagName( 'head' )[0].appendChild( link ); </script> @@ -219,8 +219,8 @@ </div> </div> - <script src="../../../lib/js/head.min.js"></script> - <script src="../../../js/reveal.js"></script> + <script src="../../reveal.js/lib/js/head.min.js"></script> + <script src="../../reveal.js/js/reveal.js"></script> <script> @@ -236,12 +236,12 @@ // Optional reveal.js plugins dependencies: [ - { src: '../../../lib/js/classList.js', condition: function() { return !document.body.classList; } }, - { src: '../../../plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: '../../../plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: '../../../plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } }, - { src: '../../../plugin/zoom-js/zoom.js', async: true }, - { src: '../../../plugin/notes/notes.js', async: true } + { src: '../../reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } }, + { src: '../../reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: '../../reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: '../../reveal.js/plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } }, + { src: '../../reveal.js/plugin/zoom-js/zoom.js', async: true }, + { src: '../../reveal.js/plugin/notes/notes.js', async: true } ] }); diff --git a/docs/com/pres/Summit/Berlin-2016/summit-Berlin.html b/docs/com/pres/Summit/Berlin-2016/summit-Berlin.html index 8369443f7..97fa66c18 100755 --- a/docs/com/pres/Summit/Berlin-2016/summit-Berlin.html +++ b/docs/com/pres/Summit/Berlin-2016/summit-Berlin.html @@ -14,23 +14,23 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui"> - <link rel="stylesheet" href="../../../css/reveal.css"> + <link rel="stylesheet" href="../../reveal.js/css/reveal.css"> <link rel="stylesheet" href="../../../css/theme/OPNFV-Berlin.css" id="theme"> <!-- Code syntax highlighting --> - <link rel="stylesheet" href="../../../lib/css/zenburn.css"> + <link rel="stylesheet" href="../../reveal.js/lib/css/zenburn.css"> <!-- Printing and PDF exports --> <script> var link = document.createElement( 'link' ); link.rel = 'stylesheet'; link.type = 'text/css'; - link.href = window.location.search.match( /print-pdf/gi ) ? '../../../css/print/pdf.css' : '../../../css/print/paper.css'; + link.href = window.location.search.match( /print-pdf/gi ) ? '../../reveal.js/css/print/pdf.css' : '../../../css/print/paper.css'; document.getElementsByTagName( 'head' )[0].appendChild( link ); </script> <!--[if lt IE 9]> - <script src="lib/js/html5shiv.js"></script> + <script src="l../../reveal.jsml5shiv.js"></script> <![endif]--> </head> @@ -277,12 +277,12 @@ </div> <div class='footer'> - <img src="../../../img/logo-OPNFV-Berlin.png" alt="OPNFV logo"> + <img src="../../../img/logo-OPNFV-Berlin.png" alt="OPNFV logo"> </div> </div> - <script src="../../../lib/js/head.min.js"></script> - <script src="../../../js/reveal.js"></script> + <script src="../../reveal.js/lib/js/head.min.js"></script> + <script src="../../reveal.js/js/reveal.js"></script> <script> @@ -298,12 +298,12 @@ // Optional reveal.js plugins dependencies: [ - { src: '../../../lib/js/classList.js', condition: function() { return !document.body.classList; } }, - { src: '../../../plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: '../../../plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: '../../../plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } }, - { src: '../../../plugin/zoom-js/zoom.js', async: true }, - { src: '../../../plugin/notes/notes.js', async: true } + { src: '../../reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } }, + { src: '../../reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: '../../reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: '../../reveal.js/plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } }, + { src: '../../reveal.js/plugin/zoom-js/zoom.js', async: true }, + { src: '../../reveal.js/plugin/notes/notes.js', async: true } ] }); diff --git a/docs/com/pres/Summit/Berlin-2016/testapi.html b/docs/com/pres/Summit/Berlin-2016/testapi.html index 16f97c44d..c40637cbf 100755 --- a/docs/com/pres/Summit/Berlin-2016/testapi.html +++ b/docs/com/pres/Summit/Berlin-2016/testapi.html @@ -14,18 +14,18 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui"> - <link rel="stylesheet" href="../../../css/reveal.css"> + <link rel="stylesheet" href="../../reveal.js/css/reveal.css"> <link rel="stylesheet" href="../../../css/theme/OPNFV-Berlin.css" id="theme"> <!-- Code syntax highlighting --> - <link rel="stylesheet" href="../../../lib/css/zenburn.css"> + <link rel="stylesheet" href="../../reveal.js/lib/css/zenburn.css"> <!-- Printing and PDF exports --> <script> var link = document.createElement( 'link' ); link.rel = 'stylesheet'; link.type = 'text/css'; - link.href = window.location.search.match( /print-pdf/gi ) ? '../../../css/print/pdf.css' : '../../../css/print/paper.css'; + link.href = window.location.search.match( /print-pdf/gi ) ? '../../reveal.js/css/print/pdf.css' : '../../reveal.js/css/print/paper.css'; document.getElementsByTagName( 'head' )[0].appendChild( link ); </script> @@ -242,8 +242,8 @@ OK </div> </div> - <script src="../../../lib/js/head.min.js"></script> - <script src="../../../js/reveal.js"></script> + <script src="../../reveal.js/lib/js/head.min.js"></script> + <script src="../../reveal.js/js/reveal.js"></script> <script> @@ -259,12 +259,12 @@ OK // Optional reveal.js plugins dependencies: [ - { src: '../../../lib/js/classList.js', condition: function() { return !document.body.classList; } }, - { src: '../../../plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: '../../../plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: '../../../plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } }, - { src: '../../../plugin/zoom-js/zoom.js', async: true }, - { src: '../../../plugin/notes/notes.js', async: true } + { src: '../../reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } }, + { src: '../../reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: '../../reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: '../../reveal.js/plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } }, + { src: '../../reveal.js/plugin/zoom-js/zoom.js', async: true }, + { src: '../../reveal.js/plugin/notes/notes.js', async: true } ] }); diff --git a/docs/com/pres/dashboard/dashboard_status.html b/docs/com/pres/dashboard/dashboard_status.html index 7d46a74c5..1321afa0c 100755 --- a/docs/com/pres/dashboard/dashboard_status.html +++ b/docs/com/pres/dashboard/dashboard_status.html @@ -14,18 +14,18 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui"> - <link rel="stylesheet" href="../../css/reveal.css"> + <link rel="stylesheet" href="../reveal.js/css/reveal.css"> <link rel="stylesheet" href="../../css/theme/OPNFV.css" id="theme"> <!-- Code syntax highlighting --> - <link rel="stylesheet" href="../../lib/css/zenburn.css"> + <link rel="stylesheet" href="../reveal.js/lib/css/zenburn.css"> <!-- Printing and PDF exports --> <script> var link = document.createElement( 'link' ); link.rel = 'stylesheet'; link.type = 'text/css'; - link.href = window.location.search.match( /print-pdf/gi ) ? '../../css/print/pdf.css' : '../../css/print/paper.css'; + link.href = window.location.search.match( /print-pdf/gi ) ? '../reveal.js/css/print/pdf.css' : '../reveal.js/css/print/paper.css'; document.getElementsByTagName( 'head' )[0].appendChild( link ); </script> @@ -114,8 +114,8 @@ </div> </div> - <script src="../../lib/js/head.min.js"></script> - <script src="../../js/reveal.js"></script> + <script src="../reveal.js/lib/js/head.min.js"></script> + <script src="../reveal.js/js/reveal.js"></script> <script> @@ -131,12 +131,12 @@ // Optional reveal.js plugins dependencies: [ - { src: '../../lib/js/classList.js', condition: function() { return !document.body.classList; } }, - { src: '../../plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: '../../plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: '../../plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } }, - { src: '../../plugin/zoom-js/zoom.js', async: true }, - { src: '../../plugin/notes/notes.js', async: true } + { src: '../reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } }, + { src: '../reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: '../reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: '../reveal.js/plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } }, + { src: '../reveal.js/plugin/zoom-js/zoom.js', async: true }, + { src: '../reveal.js/plugin/notes/notes.js', async: true } ] }); diff --git a/docs/com/pres/reveal.js b/docs/com/pres/reveal.js new file mode 160000 +Subproject a349ff43c58c23f9c837b8ea9b5fc7d4761b8de diff --git a/functest/ci/__init__.py b/functest/ci/__init__.py index e69de29bb..e69de29bb 100755..100644 --- a/functest/ci/__init__.py +++ b/functest/ci/__init__.py diff --git a/functest/ci/check_os.sh b/functest/ci/check_os.sh index 2c5c021c7..3920b7ac6 100755 --- a/functest/ci/check_os.sh +++ b/functest/ci/check_os.sh @@ -26,6 +26,11 @@ verify_connectivity() { return 1 } +verify_SSL_connectivity() { + openssl s_client -connect $1:$2 &>/dev/null + return $? +} + check_service() { local service cmd service=$1 @@ -63,10 +68,16 @@ fi echo "Checking OpenStack endpoints:" publicURL=$(openstack catalog show identity |awk '/public/ {print $4}') -publicIP=$(echo $publicURL|sed 's/^.*http\:\/\///'|sed 's/.[^:]*$//') +publicIP=$(echo $publicURL|sed 's/^.*http.*\:\/\///'|sed 's/.[^:]*$//') publicPort=$(echo $publicURL|sed 's/^.*://'|sed 's/\/.*$//') -echo ">>Verifying connectivity to the public endpoint $publicIP:$publicPort..." -verify_connectivity $publicIP $publicPort +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 ." @@ -81,10 +92,16 @@ if [ -z ${adminURL} ]; then openstack catalog show identity exit 1 fi -adminIP=$(echo $adminURL|sed 's/^.*http\:\/\///'|sed 's/.[^:]*$//') +adminIP=$(echo $adminURL|sed 's/^.*http.*\:\/\///'|sed 's/.[^:]*$//') adminPort=$(echo $adminURL|sed 's/^.*://'|sed 's/.[^\/]*$//') -echo ">>Verifying connectivity to the admin endpoint $adminIP:$adminPort..." -verify_connectivity $adminIP $adminPort +https_enabled=$(echo $adminURL | grep 'https') +if [[ -n $https_enabled ]]; then + echo ">>Verifying SSL connectivity to the admin endpoint $adminIP:$adminPort..." + verify_SSL_connectivity $adminIP $adminPort +else + echo ">>Verifying connectivity to the admin endpoint $adminIP:$adminPort..." + verify_connectivity $adminIP $adminPort +fi RETVAL=$? if [ $RETVAL -ne 0 ]; then echo "ERROR: Cannot talk to the admin endpoint $adminIP:$adminPort ." diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml index 00e44ad59..78f6257c8 100755 --- a/functest/ci/config_functest.yaml +++ b/functest/ci/config_functest.yaml @@ -125,7 +125,7 @@ rally: refstack: tempest_conf_path: openstack/refstack_client/tempest.conf - defcore_list: openstack/refstack_client/defcore_201608.txt + defcore_list: openstack/refstack_client/defcore.txt vnf: aaa: @@ -200,4 +200,6 @@ example: sg_desc: Example Security group results: + # you can also set a dir (e.g. /home/opnfv/db) to dump results + # test_db_url: file:///home/opnfv/db test_db_url: http://testresults.opnfv.org/test/api/v1 diff --git a/functest/ci/prepare_env.py b/functest/ci/prepare_env.py index 724ea14df..e9a470f9c 100755 --- a/functest/ci/prepare_env.py +++ b/functest/ci/prepare_env.py @@ -312,7 +312,7 @@ def install_tempest(): logger.debug("Tempest %s does not exist" % CONST.tempest_deployment_name) cmd = ("rally verify create-verifier --source {0} " - "--name {1} --type tempest" + "--name {1} --type tempest --system-wide" .format(CONST.dir_repo_tempest, CONST.tempest_deployment_name)) error_msg = "Problem while installing Tempest." diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml index e3d5ffad1..5f54b975d 100755 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -132,7 +132,7 @@ tiers: - name: refstack_defcore - criteria: 'success_rate >= 80%' + criteria: 'success_rate == 100%' blocking: false clean_flag: false description: >- @@ -168,7 +168,7 @@ tiers: - name: odl_netvirt criteria: 'success_rate == 100%' - blocking: true + blocking: false clean_flag: false description: >- Test Suite for the OpenDaylight SDN Controller when @@ -436,20 +436,6 @@ tiers: # module: 'functest.opnfv_tests.openstack.tempest.tempest' # class: 'TempestFullParallel' - - name: tempest_defcore - criteria: 'success_rate == 100%' - blocking: false - clean_flag: false - description: >- - This is the set of Tempest test cases created by OpenStack - Interop Working Group for certification purposes. - dependencies: - installer: '' - scenario: 'nosdn-nofeature-ha' - run: - module: 'functest.opnfv_tests.openstack.tempest.tempest' - class: 'TempestDefcore' - - name: tempest_custom criteria: 'success_rate == 100%' blocking: false diff --git a/functest/ci/tier_builder.py b/functest/ci/tier_builder.py index f4c6f70fd..f4c6f70fd 100755..100644 --- a/functest/ci/tier_builder.py +++ b/functest/ci/tier_builder.py diff --git a/functest/ci/tier_handler.py b/functest/ci/tier_handler.py index 6b4864b5b..6b4864b5b 100755..100644 --- a/functest/ci/tier_handler.py +++ b/functest/ci/tier_handler.py diff --git a/functest/core/vnf_base.py b/functest/core/vnf_base.py index 0300dd226..f5e86054f 100644 --- a/functest/core/vnf_base.py +++ b/functest/core/vnf_base.py @@ -52,8 +52,13 @@ class VnfOnBoardingBase(base.TestcaseBase): def execute(self): self.start_time = time.time() # Prepare the test (Create Tenant, User, ...) - self.logger.info("Create VNF Onboarding environment") - self.prepare() + try: + self.logger.info("Create VNF Onboarding environment") + self.prepare() + except Exception: + self.logger.error("Error during VNF Onboarding environment" + + "creation", exc_info=True) + return base.TestcaseBase.EX_TESTCASE_FAILED # Deploy orchestrator try: @@ -179,11 +184,11 @@ class VnfOnBoardingBase(base.TestcaseBase): # TODO see how to use built-in exception from releng module def deploy_vnf(self): self.logger.error("VNF must be deployed") - return base.TestcaseBase.EX_TESTCASE_FAILED + raise Exception("VNF not deployed") def test_vnf(self): self.logger.error("VNF must be tested") - return base.TestcaseBase.EX_TESTCASE_FAILED + raise Exception("VNF not tested") def clean(self): self.logger.info("test cleaning") @@ -232,4 +237,4 @@ class VnfOnBoardingBase(base.TestcaseBase): self.details[part]['status'] = 'FAIL' self.details[part]['result'] = error_msg self.logger.error("Step failure:{}".format(error_msg)) - return base.TestcaseBase.EX_TESTCASE_FAILED + raise Exception(error_msg) diff --git a/functest/opnfv_tests/features/copper.py b/functest/opnfv_tests/features/copper.py index 735b315d2..735b315d2 100755..100644 --- a/functest/opnfv_tests/features/copper.py +++ b/functest/opnfv_tests/features/copper.py diff --git a/functest/opnfv_tests/features/doctor.py b/functest/opnfv_tests/features/doctor.py index 4d295a674..4d295a674 100755..100644 --- a/functest/opnfv_tests/features/doctor.py +++ b/functest/opnfv_tests/features/doctor.py diff --git a/functest/opnfv_tests/features/domino.py b/functest/opnfv_tests/features/domino.py index b36220fa0..b36220fa0 100755..100644 --- a/functest/opnfv_tests/features/domino.py +++ b/functest/opnfv_tests/features/domino.py diff --git a/functest/opnfv_tests/features/odl_sfc.py b/functest/opnfv_tests/features/odl_sfc.py index 3b68d4204..431cd47e4 100644 --- a/functest/opnfv_tests/features/odl_sfc.py +++ b/functest/opnfv_tests/features/odl_sfc.py @@ -8,13 +8,15 @@ # http://www.apache.org/licenses/LICENSE-2.0 # import functest.core.feature_base as base +from sfc.tests.functest import run_tests class OpenDaylightSFC(base.FeatureBase): def __init__(self): super(OpenDaylightSFC, self).__init__(project='sfc', - case='functest-odl-sfc"', + case='functest-odl-sfc', repo='dir_repo_sfc') - dir_sfc_functest = '{}/sfc/tests/functest'.format(self.repo) - self.cmd = 'cd %s && python ./run_tests.py' % dir_sfc_functest + + def execute(self): + return run_tests.main() diff --git a/functest/opnfv_tests/features/promise.py b/functest/opnfv_tests/features/promise.py index 15636fbfe..15636fbfe 100755..100644 --- a/functest/opnfv_tests/features/promise.py +++ b/functest/opnfv_tests/features/promise.py diff --git a/functest/opnfv_tests/features/sdnvpn.py b/functest/opnfv_tests/features/sdnvpn.py index 1919a03c2..1919a03c2 100755..100644 --- a/functest/opnfv_tests/features/sdnvpn.py +++ b/functest/opnfv_tests/features/sdnvpn.py diff --git a/functest/opnfv_tests/features/security_scan.py b/functest/opnfv_tests/features/security_scan.py index 58f0ec748..58f0ec748 100755..100644 --- a/functest/opnfv_tests/features/security_scan.py +++ b/functest/opnfv_tests/features/security_scan.py diff --git a/functest/opnfv_tests/mano/orchestra.py b/functest/opnfv_tests/mano/orchestra.py index fd5e40d05..fd5e40d05 100755..100644 --- a/functest/opnfv_tests/mano/orchestra.py +++ b/functest/opnfv_tests/mano/orchestra.py diff --git a/functest/opnfv_tests/openstack/healthcheck/healthcheck.sh b/functest/opnfv_tests/openstack/healthcheck/healthcheck.sh index 7fa957c01..7fa957c01 100755..100644 --- a/functest/opnfv_tests/openstack/healthcheck/healthcheck.sh +++ b/functest/opnfv_tests/openstack/healthcheck/healthcheck.sh diff --git a/functest/opnfv_tests/openstack/refstack_client/defcore_201608.txt b/functest/opnfv_tests/openstack/refstack_client/defcore.txt index 26eddafcb..be8fd8998 100644 --- a/functest/opnfv_tests/openstack/refstack_client/defcore_201608.txt +++ b/functest/opnfv_tests/openstack/refstack_client/defcore.txt @@ -77,7 +77,7 @@ tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_u tempest.api.compute.test_quotas.QuotasTestJSON.test_get_default_quotas[id-9bfecac7-b966-4f47-913f-1a9e2c12134a] tempest.api.compute.test_quotas.QuotasTestJSON.test_get_quotas[id-f1ef0a97-dbbb-4cca-adc5-c9fbc4f76107] tempest.api.compute.test_versions.TestVersions.test_list_api_versions[id-6c0a0990-43b6-4529-9b61-5fd8daf7c55c] -tempest.api.compute.volumes.test_attach_volume.AttachVolumeTestJSON.test_attach_detach_volume[id-52e9045a-e90d-4c0d-9087-79d657faffff] +# tempest.api.compute.volumes.test_attach_volume.AttachVolumeTestJSON.test_attach_detach_volume[id-52e9045a-e90d-4c0d-9087-79d657faffff] tempest.api.compute.volumes.test_attach_volume.AttachVolumeTestJSON.test_list_get_volume_attachments[id-7fa563fe-f0f7-43eb-9e22-a1ece036b513] tempest.api.identity.v3.TestApiDiscovery.test_api_media_types[id-657c1970-4722-4189-8831-7325f3bc4265] tempest.api.identity.v3.TestApiDiscovery.test_api_version_resources[id-b9232f5e-d9e5-4d97-b96c-28d3db4de1bd] diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py index c9f0f2752..4312b7f9e 100755 --- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py +++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py @@ -69,8 +69,8 @@ class RefstackClient(testcase_base.TestcaseBase): self.defcorelist)) logger.info("Starting Refstack_defcore test case: '%s'." % cmd) - header = ("Tempest environment:\n" - " Installer: %s\n Scenario: %s\n Node: %s\n Date: %s\n" % + header = ("Refstack environment:\n" + " SUT: %s\n Scenario: %s\n Node: %s\n Date: %s\n" % (CONST.INSTALLER_TYPE, CONST.DEPLOY_SCENARIO, CONST.NODE_NAME, @@ -79,26 +79,23 @@ class RefstackClient(testcase_base.TestcaseBase): f_stdout = open( os.path.join(conf_utils.REFSTACK_RESULTS_DIR, "refstack.log"), 'w+') - f_stderr = open( - os.path.join(conf_utils.REFSTACK_RESULTS_DIR, - "refstack-error.log"), 'w+') f_env = open(os.path.join(conf_utils.REFSTACK_RESULTS_DIR, "environment.log"), 'w+') f_env.write(header) p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, - stderr=f_stderr, bufsize=1) + stderr=subprocess.STDOUT, bufsize=1) with p.stdout: for line in iter(p.stdout.readline, b''): if 'Tests' in line: break - logger.info(line.replace('\n', '')) + if re.search("\} tempest\.", line): + logger.info(line.replace('\n', '')) f_stdout.write(line) p.wait() f_stdout.close() - f_stderr.close() f_env.close() def parse_refstack_result(self): @@ -110,12 +107,16 @@ class RefstackClient(testcase_base.TestcaseBase): for match in re.findall("Ran: (\d+) tests in (\d+\.\d{4}) sec.", output): num_tests = match[0] - for match in re.findall("- Passed: (\d+)", output): - num_success = match - for match in re.findall("- Skipped: (\d+)", output): - num_skipped = match - for match in re.findall("- Failed: (\d+)", output): - num_failures = match + logger.info("Ran: %s tests in %s sec." % (num_tests, match[1])) + for match in re.findall("(- Passed: )(\d+)", output): + num_success = match[1] + logger.info("".join(match)) + for match in re.findall("(- Skipped: )(\d+)", output): + num_skipped = match[1] + logger.info("".join(match)) + for match in re.findall("(- Failed: )(\d+)", output): + num_failures = match[1] + logger.info("".join(match)) success_testcases = "" for match in re.findall(r"\{0\}(.*?)[. ]*ok", output): success_testcases += match + ", " @@ -129,10 +130,10 @@ class RefstackClient(testcase_base.TestcaseBase): num_executed = int(num_tests) - int(num_skipped) success_rate = 100 * int(num_success) / int(num_executed) - self.details = {"num_tests": int(num_tests), - "num_failures": int(num_failures), + self.details = {"tests": int(num_tests), + "failures": int(num_failures), "success": success_testcases, - "failed": failed_testcases, + "errors": failed_testcases, "skipped": skipped_testcases} except Exception: success_rate = 0 diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py index 67cd9415e..9d723905f 100644 --- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py +++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py @@ -5,6 +5,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 +from functest.utils import functest_logger as ft_logger from functest.core.pytest_suite_runner import PyTestSuiteRunner from functest.opnfv_tests.openstack.snaps import snaps_utils from functest.utils import functest_utils @@ -22,9 +23,11 @@ class SnapsTestRunner(PyTestSuiteRunner): super(SnapsTestRunner, self).__init__() self.ext_net_name = snaps_utils.get_ext_net_name() - + self.logger = ft_logger.Logger(self.project_name).getLogger() scenario = functest_utils.get_scenario() self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_ANY if 'ovs' in scenario or 'fdio' in scenario: self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE + + self.logger.info("Using flavor metatdata '%s'" % self.flavor_metadata) diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py index a21322d86..f4a94f654 100644 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py @@ -341,7 +341,7 @@ def configure_tempest_multisite_params(tempest_conf_file): # cmd = ("openstack endpoint show kingbird | grep publicurl |" # "awk '{print $4}' | awk -F '/' '{print $4}'") # kingbird_api_version = os.popen(cmd).read() - kingbird_api_version = os_utils.get_endpoint(service_type='multisite') + # kingbird_api_version = os_utils.get_endpoint(service_type='multisite') if CI_INSTALLER_TYPE == 'fuel': # For MOS based setup, the service is accessible @@ -392,10 +392,14 @@ def configure_tempest_multisite_params(tempest_conf_file): config.add_section("kingbird") except Exception: logger.info('kingbird section exist') + + # set the domain id + config.set('auth', 'admin_domain_name', 'default') + config.set('kingbird', 'endpoint_type', 'publicURL') - config.set('kingbird', 'TIME_TO_SYNC', '20') + config.set('kingbird', 'TIME_TO_SYNC', '120') config.set('kingbird', 'endpoint_url', kingbird_endpoint_url) - config.set('kingbird', 'api_version', kingbird_api_version) + config.set('kingbird', 'api_version', 'v1.0') with open(tempest_conf_file, 'wb') as config_file: config.write(config_file) diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt index fcdfe225b..43edabc10 100644 --- a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt @@ -55,3 +55,19 @@ - tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_volume_boot_pattern - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPatternV2.test_volume_boot_pattern + +- + # https://bugs.launchpad.net/tempest/+bug/1577632 + scenarios: + - os-odl_l2-nofeature-ha + - os-odl_l2-nofeature-noha + - os-odl_l2-sfc-ha + - os-odl_l2-sfc-noha + - os-odl_l2-bgpvpn-ha + - os-odl_l2-bgpvpn-noha + - os-odl_l3-nofeature-ha + - os-odl_l3-nofeature-noha + installers: + - fuel + tests: + - tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index d3b159264..54556a32f 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -116,7 +116,7 @@ class TempestCommon(testcase_base.TestcaseBase): logger.info("Starting Tempest test suite: '%s'." % cmd_line) header = ("Tempest environment:\n" - " Installer: %s\n Scenario: %s\n Node: %s\n Date: %s\n" % + " SUT: %s\n Scenario: %s\n Node: %s\n Date: %s\n" % (CONST.INSTALLER_TYPE, CONST.DEPLOY_SCENARIO, CONST.NODE_NAME, diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py index 2ced92e9d..f7dfd532f 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py @@ -203,7 +203,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): flavor_exist, flavor_id = os_utils.get_or_create_flavor( "m1.small", self.vnf['requirements']['ram_min'], - '20', + '30', '1', public=True) self.logger.debug("Flavor id: %s" % flavor_id) @@ -261,6 +261,9 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): dns_ip = dep_outputs.json()['outputs']['dns_ip'] ellis_ip = dep_outputs.json()['outputs']['ellis_ip'] + self.logger.debug("DNS ip : %s" % dns_ip) + self.logger.debug("ELLIS ip : %s" % ellis_ip) + ellis_url = "http://" + ellis_ip + "/" url = ellis_url + "accounts" @@ -270,9 +273,11 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): "signup_code": "secret"} rq = requests.post(url, data=params) - i = 20 + i = 30 while rq.status_code != 201 and i > 0: rq = requests.post(url, data=params) + self.logger.debug("Account creation http status code: %s" + % rq.status_code) i = i - 1 time.sleep(10) @@ -281,8 +286,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): rq = requests.post(url, data=params) cookies = rq.cookies else: - self.step_failure("Unable to create an account for number" + - " provision: %s" % rq.json()['reason']) + self.step_failure("Unable to create an account") url = ellis_url + "accounts/" + params['email'] + "/numbers" if cookies != "": @@ -290,6 +294,8 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): i = 24 while rq.status_code != 200 and i > 0: rq = requests.post(url, cookies=cookies) + self.logger.debug("Number creation http status code: %s" + % rq.status_code) i = i - 1 time.sleep(25) diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml b/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml index b84ef8fd2..74b9e9580 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml @@ -6,7 +6,7 @@ cloudify: url: https://github.com/boucherv-orange/cloudify-manager-blueprints.git branch: '3.3.1-build' requirements: - ram_min: 4000 + ram_min: 4096 os_image: centos_7 inputs: keystone_username: "" @@ -29,7 +29,7 @@ clearwater: branch: stable deployment_name: clearwater-opnfv requirements: - ram_min: 2000 + ram_min: 2048 os_image: ubuntu_14.04 inputs: image_id: '' diff --git a/functest/opnfv_tests/vnf/ims/opera_ims.py b/functest/opnfv_tests/vnf/ims/opera_ims.py index 7ead401fe..7ead401fe 100644..100755 --- a/functest/opnfv_tests/vnf/ims/opera_ims.py +++ b/functest/opnfv_tests/vnf/ims/opera_ims.py diff --git a/functest/opnfv_tests/vnf/ims/orchestra_ims.py b/functest/opnfv_tests/vnf/ims/orchestra_ims.py index 42b218e62..5c19be096 100644..100755 --- a/functest/opnfv_tests/vnf/ims/orchestra_ims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_ims.py @@ -245,7 +245,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): % (self.imagename, network_id, userdata)) instance = os_utils.create_instance_and_wait_for_active( - "m1.medium", + "orchestra", os_utils.get_image_id(glance_client, self.imagename), network_id, "orchestra-openbaton", @@ -308,12 +308,21 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): if self.ob_projectid == "": self.step_failure("Default project id was not found!") + creds = os_utils.get_credentials() + self.logger.info("PoP creds: %s" % creds) + + project_id = os_utils.get_tenant_id( + os_utils.get_keystone_client(), + creds.get("project_name")) + + self.logger.debug("project id: %s" % project_id) + vim_json = { "name": "vim-instance", - "authUrl": os_utils.get_credentials().get("auth_url"), - "tenant": os_utils.get_credentials().get("tenant_name"), - "username": os_utils.get_credentials().get("username"), - "password": os_utils.get_credentials().get("password"), + "authUrl": creds.get("auth_url"), + "tenant": project_id, + "username": creds.get("username"), + "password": creds.get("password"), "securityGroups": [ "default", "orchestra-sec-group" diff --git a/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml b/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml index 86d6e604a..5923a775a 100644 --- a/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml +++ b/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml @@ -2,8 +2,8 @@ tenant_images: ubuntu_14.04: http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img openims: http://marketplace.openbaton.org:8082/api/v1/images/52e2ccc0-1dce-4663-894d-28aab49323aa/img openbaton: - bootstrap_link: http://get.openbaton.org/bootstrap - bootstrap_config_link: http://get.openbaton.org/bootstrap-config-file + bootstrap_link: http://get.openbaton.org/bootstraps/bootstrap_3.2.0_opnfv/bootstrap + bootstrap_config_link: http://get.openbaton.org/bootstraps/bootstrap_3.2.0_opnfv/bootstrap-config-file marketplace_link: http://marketplace.openbaton.org:8082/api/v1/nsds/fokus/OpenImsCore/3.2.0/json imagename: ubuntu_14.04 vIMS: diff --git a/functest/opnfv_tests/vnf/router/__init__.py b/functest/opnfv_tests/vnf/router/__init__.py index e69de29bb..e69de29bb 100755..100644 --- a/functest/opnfv_tests/vnf/router/__init__.py +++ b/functest/opnfv_tests/vnf/router/__init__.py diff --git a/functest/opnfv_tests/vnf/router/vyos_vrouter.py b/functest/opnfv_tests/vnf/router/vyos_vrouter.py index 94a3ecfd8..94a3ecfd8 100755..100644 --- a/functest/opnfv_tests/vnf/router/vyos_vrouter.py +++ b/functest/opnfv_tests/vnf/router/vyos_vrouter.py diff --git a/functest/tests/unit/core/test_vnf_base.py b/functest/tests/unit/core/test_vnf_base.py index 25a74b7c9..1680f03f5 100644 --- a/functest/tests/unit/core/test_vnf_base.py +++ b/functest/tests/unit/core/test_vnf_base.py @@ -8,11 +8,9 @@ # http://www.apache.org/licenses/LICENSE-2.0 import logging -import mock import unittest from functest.core import vnf_base -from functest.core import testcase_base class VnfBaseTesting(unittest.TestCase): @@ -37,17 +35,15 @@ class VnfBaseTesting(unittest.TestCase): "result": "", "duration": 5}} - @mock.patch('logging.Logger.error') - def test_deploy_vnf_unimplemented(self, mock): - self.assertEqual(self.test.deploy_vnf(), - testcase_base.TestcaseBase.EX_TESTCASE_FAILED) - mock.assert_called_with('VNF must be deployed') - - @mock.patch('logging.Logger.error') - def test_test_vnf_unimplemented(self, mock): - self.assertEqual(self.test.test_vnf(), - testcase_base.TestcaseBase.EX_TESTCASE_FAILED) - mock.assert_called_with('VNF must be tested') + def test_deploy_vnf_unimplemented(self): + with self.assertRaises(Exception) as context: + self.test.deploy_vnf() + self.assertTrue('VNF not deployed' in context.exception) + + def test_test_vnf_unimplemented(self): + with self.assertRaises(Exception) as context: + self.test.test_vnf()() + self.assertTrue('VNF not tested' in context.exception) def test_parse_results(self): self.assertNotEqual(self.test.parse_results(), 0) diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py index 8bfdb5e49..eb241e5d0 100644 --- a/functest/tests/unit/utils/test_functest_utils.py +++ b/functest/tests/unit/utils/test_functest_utils.py @@ -33,6 +33,7 @@ class FunctestUtilsTesting(unittest.TestCase): self.installer = 'test_installer' self.scenario = 'test_scenario' self.build_tag = 'jenkins-functest-fuel-opnfv-jump-2-daily-master-190' + self.build_tag_week = 'jenkins-functest-fuel-baremetal-weekly-master-8' self.version = 'master' self.node_name = 'test_node_name' self.project = 'test_project' @@ -152,11 +153,21 @@ class FunctestUtilsTesting(unittest.TestCase): self.scenario) @mock.patch('functest.utils.functest_utils.get_build_tag') - def test_get_version_default(self, mock_get_build_tag): + def test_get_version_daily_job(self, mock_get_build_tag): mock_get_build_tag.return_value = self.build_tag self.assertEqual(functest_utils.get_version(), self.version) @mock.patch('functest.utils.functest_utils.get_build_tag') + def test_get_version_weekly_job(self, mock_get_build_tag): + mock_get_build_tag.return_value = self.build_tag_week + self.assertEqual(functest_utils.get_version(), self.version) + + @mock.patch('functest.utils.functest_utils.get_build_tag') + def test_get_version_with_dummy_build_tag(self, mock_get_build_tag): + mock_get_build_tag.return_value = 'whatever' + self.assertEqual(functest_utils.get_version(), 'unknown') + + @mock.patch('functest.utils.functest_utils.get_build_tag') def test_get_version_unknown(self, mock_get_build_tag): mock_get_build_tag.return_value = "unknown_build_tag" self.assertEqual(functest_utils.get_version(), "unknown") @@ -284,25 +295,6 @@ class FunctestUtilsTesting(unittest.TestCase): def test_push_results_to_db_missing_buildtag(self): self._test_push_results_to_db_missing_env('BUILD_TAG') - def test_push_results_to_db_incorrect_buildtag(self): - dic = self._get_env_dict(None) - dic['BUILD_TAG'] = 'incorrect_build_tag' - with mock.patch('functest.utils.functest_utils.get_db_url', - return_value=self.db_url), \ - mock.patch.dict(os.environ, - dic, - clear=True), \ - mock.patch('functest.utils.functest_utils.logger.error') \ - as mock_logger_error: - self.assertFalse(functest_utils. - push_results_to_db(self.project, self.case_name, - self.start_date, - self.stop_date, - self.criteria, self.details)) - mock_logger_error.assert_called_once_with("Please fix BUILD_TAG" - " env var: incorrect_" - "build_tag") - def test_push_results_to_db_request_post_failed(self): dic = self._get_env_dict(None) with mock.patch('functest.utils.functest_utils.get_db_url', diff --git a/functest/tests/unit/utils/test_openstack_utils.py b/functest/tests/unit/utils/test_openstack_utils.py index ef3764cc5..673ad5e20 100644 --- a/functest/tests/unit/utils/test_openstack_utils.py +++ b/functest/tests/unit/utils/test_openstack_utils.py @@ -28,7 +28,8 @@ class OSUtilsTesting(unittest.TestCase): 'OS_PROJECT_DOMAIN_NAME': os_prefix + 'project_domain_name', 'OS_PROJECT_NAME': os_prefix + 'project_name', 'OS_ENDPOINT_TYPE': os_prefix + 'endpoint_type', - 'OS_REGION_NAME': os_prefix + 'region_name'} + 'OS_REGION_NAME': os_prefix + 'region_name', + 'OS_CACERT': os_prefix + 'https_cacert'} def _get_os_env_vars(self): return {'username': 'test_username', 'password': 'test_password', @@ -37,7 +38,8 @@ class OSUtilsTesting(unittest.TestCase): 'project_domain_name': 'test_project_domain_name', 'project_name': 'test_project_name', 'endpoint_type': 'test_endpoint_type', - 'region_name': 'test_region_name'} + 'region_name': 'test_region_name', + 'https_cacert': 'test_https_cacert'} def setUp(self): self.env_vars = ['OS_AUTH_URL', 'OS_USERNAME', 'OS_PASSWORD'] diff --git a/functest/utils/decorators.py b/functest/utils/decorators.py index 99bcef3e6..276235d96 100644 --- a/functest/utils/decorators.py +++ b/functest/utils/decorators.py @@ -1,6 +1,8 @@ #!/usr/bin/env python +import errno import mock +import os import requests.sessions import urlparse @@ -10,7 +12,12 @@ def can_dump_request_to_file(method): def dump_preparedrequest(request, **kwargs): parseresult = urlparse.urlparse(request.url) if parseresult.scheme == "file": - with open(parseresult.path.replace('/results', ''), 'a') as f: + try: + os.makedirs(parseresult.path) + except OSError as e: + if e.errno != errno.EEXIST: + raise + with open(os.path.join(parseresult.path, 'dump.txt'), 'a') as f: headers = "" for key in request.headers: headers += key + " " + request.headers[key] + "\n" diff --git a/functest/utils/functest_logger.py b/functest/utils/functest_logger.py index 022211cb7..555e9c28c 100755..100644 --- a/functest/utils/functest_logger.py +++ b/functest/utils/functest_logger.py @@ -28,13 +28,24 @@ import json from functest.utils.constants import CONST +ignore = ["paramiko", + "stevedore.extension", + "keystoneauth.session", + "keystoneauth.identity.v3.base", + "novaclient.v2.client", + "neutronclient.v2_0.client", + "glanceclient.common.http", + "cinderclient.v2.client", + "cinderclient.client"] + class Logger(object): def __init__(self, logger_name): self.setup_logging() self.logger = logging.getLogger(logger_name) - logging.getLogger("paramiko").setLevel(logging.WARNING) + for module_name in ignore: + logging.getLogger(module_name).setLevel(logging.WARNING) def getLogger(self): return self.logger diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py index e5e755d7f..7cc5029d9 100644 --- a/functest/utils/functest_utils.py +++ b/functest/utils/functest_utils.py @@ -111,12 +111,13 @@ def get_version(): # if launched through CI the build tag has the following format # jenkins-<project>-<installer>-<pod>-<job>-<branch>-<id> # e.g. jenkins-functest-fuel-opnfv-jump-2-daily-master-190 + # jenkins-functest-fuel-baremetal-weekly-master-8 # use regex to match branch info - rule = "daily-(.+?)-[0-9]*" + rule = "(dai|week)ly-(.+?)-[0-9]*" build_tag = get_build_tag() m = re.search(rule, build_tag) if m: - return m.group(1) + return m.group(2) else: return "unknown" @@ -156,8 +157,6 @@ def get_db_url(): # if TEST_DB_URL declared in env variable, use it! db_url = os.environ['TEST_DB_URL'] except KeyError: - logger.info("DB URL not declared as env variable," - "use local configuration") db_url = get_functest_config('results.test_db_url') return db_url @@ -208,13 +207,7 @@ def push_results_to_db(project, case_name, except KeyError as e: logger.error("Please set env var: " + str(e)) return False - rule = "daily-(.+?)-[0-9]*" - m = re.search(rule, build_tag) - if m: - version = m.group(1) - else: - logger.error("Please fix BUILD_TAG env var: " + build_tag) - return False + version = get_version() test_start = dt.fromtimestamp(start_date).strftime('%Y-%m-%d %H:%M:%S') test_stop = dt.fromtimestamp(stop_date).strftime('%Y-%m-%d %H:%M:%S') diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py index e33af63b4..ffc870f62 100755..100644 --- a/functest/utils/openstack_utils.py +++ b/functest/utils/openstack_utils.py @@ -82,7 +82,8 @@ def get_env_cred_dict(): 'OS_PROJECT_DOMAIN_NAME': 'project_domain_name', 'OS_PROJECT_NAME': 'project_name', 'OS_ENDPOINT_TYPE': 'endpoint_type', - 'OS_REGION_NAME': 'region_name' + 'OS_REGION_NAME': 'region_name', + 'OS_CACERT': 'https_cacert' } return env_cred_dict @@ -149,6 +150,11 @@ def get_credentials_for_rally(): if region_name is not None: cred_key = env_cred_dict.get('OS_REGION_NAME') rally_conf[cred_key] = region_name + + cacert = os.getenv('OS_CACERT') + if cacert is not None: + cred_key = env_cred_dict.get('OS_CACERT') + rally_conf[cred_key] = cacert return rally_conf @@ -168,7 +174,14 @@ def get_endpoint(service_type, endpoint_type='publicURL'): def get_session(other_creds={}): auth = get_session_auth(other_creds) - return session.Session(auth=auth) + cacert = os.getenv('OS_CACERT') + if cacert is not None: + if not os.path.isfile(cacert): + raise Exception("The 'OS_CACERT' environment" + "variable is set to %s but the file" + "does not exist.", cacert) + + return session.Session(auth=auth, verify=cacert) # ********************************************* diff --git a/kingbird_requirements.txt b/kingbird_requirements.txt new file mode 100644 index 000000000..adf1082cb --- /dev/null +++ b/kingbird_requirements.txt @@ -0,0 +1,15 @@ +# +# +# 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 +# +ddt==1.1.1 +oslosphinx==4.11.0 +oslotest==2.14.0 +pylint==1.4.5 +requests-mock==1.3.0 +tempest-lib==1.0.0 +testresources==2.0.1 +testscenarios==0.5.0 |