summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--INFO31
-rw-r--r--docs/api/Makefile225
-rw-r--r--docs/api/apidoc/functest.core.feature.rst7
-rw-r--r--docs/api/apidoc/functest.core.rst17
-rw-r--r--docs/api/apidoc/functest.core.testcase.rst7
-rw-r--r--docs/api/apidoc/functest.core.vnf_base.rst7
-rw-r--r--docs/api/apidoc/functest.opnfv_tests.rst14
-rw-r--r--docs/api/apidoc/functest.opnfv_tests.sdn.odl.odl.rst7
-rw-r--r--docs/api/apidoc/functest.opnfv_tests.sdn.odl.rst15
-rw-r--r--docs/api/apidoc/functest.opnfv_tests.sdn.rst14
-rw-r--r--docs/api/apidoc/functest.rst15
-rw-r--r--docs/api/apidoc/modules.rst7
-rw-r--r--docs/api/conf.py340
-rw-r--r--docs/api/index.rst18
-rw-r--r--docs/testing/user/userguide/index.rst2
-rwxr-xr-xfunctest/ci/check_os.sh4
-rw-r--r--[-rwxr-xr-x]functest/ci/config_functest.yaml8
-rw-r--r--[-rwxr-xr-x]functest/ci/config_patch.yaml4
-rw-r--r--functest/ci/installer_params.yaml8
-rw-r--r--functest/ci/rally_aarch64_patch.conf4
-rwxr-xr-xfunctest/ci/run_tests.py5
-rw-r--r--[-rwxr-xr-x]functest/ci/testcases.yaml229
-rw-r--r--functest/ci/tier_builder.py2
-rw-r--r--functest/ci/tier_handler.py2
-rw-r--r--functest/core/feature.py144
-rw-r--r--functest/core/pytest_suite_runner.py8
-rw-r--r--functest/core/testcase.py68
-rw-r--r--functest/core/vnf_base.py126
-rw-r--r--functest/opnfv_tests/features/barometer.py5
-rw-r--r--functest/opnfv_tests/features/copper.py25
-rw-r--r--functest/opnfv_tests/features/doctor.py24
-rw-r--r--functest/opnfv_tests/features/domino.py25
-rw-r--r--functest/opnfv_tests/features/netready.py22
-rw-r--r--functest/opnfv_tests/features/odl_sfc.py20
-rw-r--r--functest/opnfv_tests/features/promise.py24
-rw-r--r--functest/opnfv_tests/features/sdnvpn.py20
-rw-r--r--functest/opnfv_tests/features/security_scan.py24
-rw-r--r--functest/opnfv_tests/mano/orchestra.py11
-rw-r--r--functest/opnfv_tests/openstack/rally/rally.py20
-rwxr-xr-xfunctest/opnfv_tests/openstack/refstack_client/refstack_client.py14
-rw-r--r--functest/opnfv_tests/openstack/snaps/api_check.py15
-rw-r--r--functest/opnfv_tests/openstack/snaps/connection_check.py15
-rw-r--r--functest/opnfv_tests/openstack/snaps/health_check.py14
-rw-r--r--functest/opnfv_tests/openstack/snaps/smoke.py25
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_test_runner.py18
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_utils.py8
-rw-r--r--functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt3
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py50
-rw-r--r--functest/opnfv_tests/openstack/vping/vping_base.py6
-rwxr-xr-xfunctest/opnfv_tests/openstack/vping/vping_ssh.py6
-rwxr-xr-xfunctest/opnfv_tests/openstack/vping/vping_userdata.py6
-rwxr-xr-xfunctest/opnfv_tests/sdn/odl/odl.py7
-rw-r--r--functest/opnfv_tests/sdn/onos/onos.py74
-rwxr-xr-xfunctest/opnfv_tests/vnf/aaa/aaa.py8
-rw-r--r--functest/opnfv_tests/vnf/ims/clearwater_ims_base.py7
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims.py9
-rw-r--r--functest/opnfv_tests/vnf/ims/opera_ims.py2
-rwxr-xr-xfunctest/opnfv_tests/vnf/ims/orchestra_ims.py2
-rw-r--r--functest/opnfv_tests/vnf/rnc/parser.py26
-rw-r--r--functest/opnfv_tests/vnf/router/vyos_vrouter.py11
-rw-r--r--functest/tests/unit/ci/test_tier_builder.py2
-rw-r--r--functest/tests/unit/core/test_feature.py134
-rw-r--r--functest/tests/unit/core/test_testcase.py92
-rw-r--r--functest/tests/unit/core/test_vnf_base.py2
-rw-r--r--functest/tests/unit/features/test_barometer.py27
-rw-r--r--functest/tests/unit/features/test_copper.py38
-rw-r--r--functest/tests/unit/features/test_doctor.py38
-rw-r--r--functest/tests/unit/features/test_domino.py38
-rw-r--r--functest/tests/unit/features/test_netready.py39
-rw-r--r--functest/tests/unit/features/test_odl_sfc.py39
-rw-r--r--functest/tests/unit/features/test_promise.py39
-rw-r--r--functest/tests/unit/features/test_sdnvpn.py39
-rw-r--r--functest/tests/unit/features/test_security_scan.py42
-rw-r--r--functest/tests/unit/odl/test_odl.py48
-rw-r--r--functest/tests/unit/openstack/__init__.py (renamed from functest/opnfv_tests/vnf/rnc/__init__.py)0
-rw-r--r--functest/tests/unit/openstack/rally/__init__.py (renamed from functest/tests/unit/opnfv_tests/__init__.py)0
-rw-r--r--functest/tests/unit/openstack/rally/test_rally.py (renamed from functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py)0
-rw-r--r--functest/tests/unit/openstack/refstack_client/__init__.py (renamed from functest/tests/unit/opnfv_tests/openstack/__init__.py)0
-rw-r--r--functest/tests/unit/openstack/refstack_client/test_refstack_client.py (renamed from functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py)0
-rw-r--r--functest/tests/unit/openstack/tempest/__init__.py (renamed from functest/tests/unit/opnfv_tests/openstack/rally/__init__.py)0
-rw-r--r--functest/tests/unit/openstack/tempest/test_conf_utils.py (renamed from functest/tests/unit/opnfv_tests/openstack/tempest/test_conf_utils.py)0
-rw-r--r--functest/tests/unit/openstack/tempest/test_tempest.py (renamed from functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py)168
-rw-r--r--functest/tests/unit/opnfv_tests/vnf/ims/__init__.py0
-rw-r--r--functest/tests/unit/utils/test_functest_utils.py19
-rw-r--r--functest/tests/unit/vnf/__init__.py (renamed from functest/tests/unit/opnfv_tests/openstack/refstack_client/__init__.py)0
-rw-r--r--functest/tests/unit/vnf/ims/__init__.py (renamed from functest/tests/unit/opnfv_tests/openstack/tempest/__init__.py)0
-rw-r--r--functest/tests/unit/vnf/ims/test_clearwater.py (renamed from functest/tests/unit/opnfv_tests/vnf/ims/test_clearwater.py)0
-rw-r--r--functest/tests/unit/vnf/ims/test_cloudify_ims.py (renamed from functest/tests/unit/opnfv_tests/vnf/ims/test_cloudify_ims.py)0
-rw-r--r--functest/tests/unit/vnf/ims/test_ims_base.py (renamed from functest/tests/unit/opnfv_tests/vnf/ims/test_ims_base.by)6
-rw-r--r--functest/tests/unit/vnf/ims/test_orchestrator_cloudify.py (renamed from functest/tests/unit/opnfv_tests/vnf/ims/test_orchestrator_cloudify.py)0
-rw-r--r--functest/tests/unit/vnf/rnc/__init__.py (renamed from functest/tests/unit/opnfv_tests/vnf/__init__.py)0
-rw-r--r--functest/utils/decorators.py23
-rw-r--r--functest/utils/functest_logger.py7
-rw-r--r--functest/utils/functest_utils.py33
-rw-r--r--functest/utils/openstack_utils.py18
-rw-r--r--requirements.txt1
-rwxr-xr-xrun_unit_tests.sh13
98 files changed, 1578 insertions, 1212 deletions
diff --git a/.gitignore b/.gitignore
index 0bb8500aa..d8ba0a976 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
.pydevproject
rally_conf.json
/docs_build/
+_build
/docs_output/
/releng/
.idea
diff --git a/INFO b/INFO
index 6f8963e76..c38b3c62c 100644
--- a/INFO
+++ b/INFO
@@ -11,19 +11,24 @@ IRC: Server:freenode.net Channel:#opnfv-functest
Repository: functest
Committers:
-yaohelan@huawei.com
-feng.xiaowei@zte.com.cn
-ollivier.cedric@gmail.com
-jose.lausuch@ericsson.com
-morgan.richomme@orange.com
-meimei@huawei.com
-valentin.boucher@orange.com
-lanqinglong@huawei.com
-viktor.tikkanen@nokia.com
-juha.kosonen@nokia.com
-zhanghaoyu7@huawei.com
-raghavendrachari.kamsali@hpe.com
-lixiaoguang5@huawei.com
+Morgan Richomme <morgan.richomme@orange.com>
+Jose Lausuch <jose.lausuch@ericsson.com>
+Cedric Ollivier <ollivier.cedric@gmail.com>
+Helen Yao <yaohelan@huawei.com>
+Serena Feng <feng.xiaowei@zte.com.cn>
+Juha Kosonen <juha.kosonen@nokia.com>
+Valentin Boucher <valentin.boucher@orange.com>
+Viktor Tikkanen <viktor.tikkanen@nokia.com>
+Mei Mei <meimei@huawei.com>
+
+Additional contributors:
+Linda Wang <wangwulin@huawei.com>
+Georgios Paraskevopoulos <georgepar.91@gmail.com>
+Romanos Skiadas <rom.skiad@gmail.com>
+Michael Polenchuk <mpolenchuk@mirantis.com>
+Cristina Pauna <cristina.pauna@enea.com>
+Matthew Li <matthew.lijun@huawei.com>
+Steven Pisarski <s.pisarski@cablelabs.com>
Link to TSC approval of the project: http://meetbot.opnfv.org/meetings/opnfv-meeting/2015/opnfv-meeting.2015-01-20-14.57.html
diff --git a/docs/api/Makefile b/docs/api/Makefile
new file mode 100644
index 000000000..ca9cfdc0b
--- /dev/null
+++ b/docs/api/Makefile
@@ -0,0 +1,225 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = _build
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " singlehtml to make a single large HTML file"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " applehelp to make an Apple Help Book"
+ @echo " devhelp to make HTML files and a Devhelp project"
+ @echo " epub to make an epub"
+ @echo " epub3 to make an epub3"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
+ @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+ @echo " text to make text files"
+ @echo " man to make manual pages"
+ @echo " texinfo to make Texinfo files"
+ @echo " info to make Texinfo files and run them through makeinfo"
+ @echo " gettext to make PO message catalogs"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " xml to make Docutils-native XML files"
+ @echo " pseudoxml to make pseudoxml-XML files for display purposes"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+ @echo " coverage to run coverage check of the documentation (if enabled)"
+ @echo " dummy to check syntax errors of document sources"
+
+.PHONY: clean
+clean:
+ rm -rf $(BUILDDIR)/*
+
+.PHONY: html
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+.PHONY: dirhtml
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+.PHONY: singlehtml
+singlehtml:
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+ @echo
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+.PHONY: pickle
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+.PHONY: json
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+.PHONY: htmlhelp
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+.PHONY: qthelp
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/OPNFVFunctest.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/OPNFVFunctest.qhc"
+
+.PHONY: applehelp
+applehelp:
+ $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
+ @echo
+ @echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
+ @echo "N.B. You won't be able to view it unless you put it in" \
+ "~/Library/Documentation/Help or install it in your application" \
+ "bundle."
+
+.PHONY: devhelp
+devhelp:
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+ @echo
+ @echo "Build finished."
+ @echo "To view the help file:"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/OPNFVFunctest"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/OPNFVFunctest"
+ @echo "# devhelp"
+
+.PHONY: epub
+epub:
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+ @echo
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+.PHONY: epub3
+epub3:
+ $(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
+ @echo
+ @echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
+
+.PHONY: latex
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
+ "(use \`make latexpdf' here to do that automatically)."
+
+.PHONY: latexpdf
+latexpdf:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through pdflatex..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+.PHONY: latexpdfja
+latexpdfja:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through platex and dvipdfmx..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+.PHONY: text
+text:
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+ @echo
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+.PHONY: man
+man:
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+.PHONY: texinfo
+texinfo:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo
+ @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+ @echo "Run \`make' in that directory to run these through makeinfo" \
+ "(use \`make info' here to do that automatically)."
+
+.PHONY: info
+info:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo "Running Texinfo files through makeinfo..."
+ make -C $(BUILDDIR)/texinfo info
+ @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+.PHONY: gettext
+gettext:
+ $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+ @echo
+ @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+.PHONY: changes
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+.PHONY: linkcheck
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+.PHONY: doctest
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
+
+.PHONY: coverage
+coverage:
+ $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
+ @echo "Testing of coverage in the sources finished, look at the " \
+ "results in $(BUILDDIR)/coverage/python.txt."
+
+.PHONY: xml
+xml:
+ $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+ @echo
+ @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+.PHONY: pseudoxml
+pseudoxml:
+ $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+ @echo
+ @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
+
+.PHONY: dummy
+dummy:
+ $(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
+ @echo
+ @echo "Build finished. Dummy builder generates no files."
diff --git a/docs/api/apidoc/functest.core.feature.rst b/docs/api/apidoc/functest.core.feature.rst
new file mode 100644
index 000000000..a80e38daa
--- /dev/null
+++ b/docs/api/apidoc/functest.core.feature.rst
@@ -0,0 +1,7 @@
+functest.core.feature module
+============================
+
+.. automodule:: functest.core.feature
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/api/apidoc/functest.core.rst b/docs/api/apidoc/functest.core.rst
new file mode 100644
index 000000000..29c67e4e3
--- /dev/null
+++ b/docs/api/apidoc/functest.core.rst
@@ -0,0 +1,17 @@
+functest.core package
+=====================
+
+.. automodule:: functest.core
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+Submodules
+----------
+
+.. toctree::
+
+ functest.core.feature
+ functest.core.testcase
+ functest.core.vnf_base
+
diff --git a/docs/api/apidoc/functest.core.testcase.rst b/docs/api/apidoc/functest.core.testcase.rst
new file mode 100644
index 000000000..2f947a1bf
--- /dev/null
+++ b/docs/api/apidoc/functest.core.testcase.rst
@@ -0,0 +1,7 @@
+functest.core.testcase module
+=============================
+
+.. automodule:: functest.core.testcase
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/api/apidoc/functest.core.vnf_base.rst b/docs/api/apidoc/functest.core.vnf_base.rst
new file mode 100644
index 000000000..94b2eaa90
--- /dev/null
+++ b/docs/api/apidoc/functest.core.vnf_base.rst
@@ -0,0 +1,7 @@
+functest.core.vnf_base module
+=============================
+
+.. automodule:: functest.core.vnf_base
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/api/apidoc/functest.opnfv_tests.rst b/docs/api/apidoc/functest.opnfv_tests.rst
new file mode 100644
index 000000000..52c2d4598
--- /dev/null
+++ b/docs/api/apidoc/functest.opnfv_tests.rst
@@ -0,0 +1,14 @@
+functest.opnfv_tests package
+============================
+
+.. automodule:: functest.opnfv_tests
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+Subpackages
+-----------
+
+.. toctree::
+
+ functest.opnfv_tests.sdn
diff --git a/docs/api/apidoc/functest.opnfv_tests.sdn.odl.odl.rst b/docs/api/apidoc/functest.opnfv_tests.sdn.odl.odl.rst
new file mode 100644
index 000000000..e6f8c7367
--- /dev/null
+++ b/docs/api/apidoc/functest.opnfv_tests.sdn.odl.odl.rst
@@ -0,0 +1,7 @@
+functest.opnfv_tests.sdn.odl.odl module
+=======================================
+
+.. automodule:: functest.opnfv_tests.sdn.odl.odl
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/api/apidoc/functest.opnfv_tests.sdn.odl.rst b/docs/api/apidoc/functest.opnfv_tests.sdn.odl.rst
new file mode 100644
index 000000000..60659a1e3
--- /dev/null
+++ b/docs/api/apidoc/functest.opnfv_tests.sdn.odl.rst
@@ -0,0 +1,15 @@
+functest.opnfv_tests.sdn.odl package
+====================================
+
+.. automodule:: functest.opnfv_tests.sdn.odl
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+Submodules
+----------
+
+.. toctree::
+
+ functest.opnfv_tests.sdn.odl.odl
+
diff --git a/docs/api/apidoc/functest.opnfv_tests.sdn.rst b/docs/api/apidoc/functest.opnfv_tests.sdn.rst
new file mode 100644
index 000000000..ca8ae77da
--- /dev/null
+++ b/docs/api/apidoc/functest.opnfv_tests.sdn.rst
@@ -0,0 +1,14 @@
+functest.opnfv_tests.sdn package
+================================
+
+.. automodule:: functest.opnfv_tests.sdn
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+Subpackages
+-----------
+
+.. toctree::
+
+ functest.opnfv_tests.sdn.odl
diff --git a/docs/api/apidoc/functest.rst b/docs/api/apidoc/functest.rst
new file mode 100644
index 000000000..63860f8f3
--- /dev/null
+++ b/docs/api/apidoc/functest.rst
@@ -0,0 +1,15 @@
+functest package
+================
+
+.. automodule:: functest
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+Subpackages
+-----------
+
+.. toctree::
+
+ functest.core
+ functest.opnfv_tests
diff --git a/docs/api/apidoc/modules.rst b/docs/api/apidoc/modules.rst
new file mode 100644
index 000000000..b8f33304a
--- /dev/null
+++ b/docs/api/apidoc/modules.rst
@@ -0,0 +1,7 @@
+functest
+========
+
+.. toctree::
+ :maxdepth: 4
+
+ functest
diff --git a/docs/api/conf.py b/docs/api/conf.py
new file mode 100644
index 000000000..746a90fe0
--- /dev/null
+++ b/docs/api/conf.py
@@ -0,0 +1,340 @@
+# -*- coding: utf-8 -*-
+#
+# OPNFV Functest documentation build configuration file, created by
+# sphinx-quickstart on Mon Apr 17 10:03:43 2017.
+#
+# This file is execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#
+# import os
+# import sys
+# sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#
+# needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+ 'sphinx.ext.autodoc',
+]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix(es) of source filenames.
+# You can specify multiple suffix as a list of string:
+#
+# source_suffix = ['.rst', '.md']
+source_suffix = '.rst'
+
+# The encoding of source files.
+#
+# source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'OPNFV Functest'
+copyright = u'2017, #opnfv-functest (chat.freenode.net)'
+author = u'#opnfv-functest (chat.freenode.net)'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = u'master'
+# The full version, including alpha/beta/rc tags.
+release = u'master'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#
+# This is also used if you do content translation via gettext catalogs.
+# Usually you set "language" from the command line for these cases.
+language = 'en'
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#
+# today = ''
+#
+# Else, today_fmt is used as the format for a strftime call.
+#
+# today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+# This patterns also effect to html_static_path and html_extra_path
+exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
+
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
+#
+# default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#
+# add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#
+# add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#
+# show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+# modindex_common_prefix = []
+
+# If true, keep warnings as "system message" paragraphs in the built documents.
+# keep_warnings = False
+
+# If true, `todo` and `todoList` produce output, else they produce nothing.
+todo_include_todos = False
+
+
+# -- Options for HTML output ----------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+#
+html_theme = 'alabaster'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#
+# html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+# html_theme_path = []
+
+# The name for this set of Sphinx documents.
+# "<project> v<release> documentation" by default.
+#
+# html_title = u'OPNFV Functest vmaster'
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#
+# html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#
+# html_logo = None
+
+# The name of an image file (relative to this directory) to use as a favicon of
+# the docs. This file should be a Windows icon file (.ico) being 16x16 or
+# 32x32 pixels large.
+#
+# html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+#
+# html_extra_path = []
+
+# If not None, a 'Last updated on:' timestamp is inserted at every page
+# bottom, using the given strftime format.
+# The empty string is equivalent to '%b %d, %Y'.
+#
+# html_last_updated_fmt = None
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#
+# html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#
+# html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#
+# html_additional_pages = {}
+
+# If false, no module index is generated.
+#
+# html_domain_indices = True
+
+# If false, no index is generated.
+#
+# html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#
+# html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#
+# html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#
+# html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#
+# html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#
+# html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+# html_file_suffix = None
+
+# Language to be used for generating the HTML full-text search index.
+# Sphinx supports the following languages:
+# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
+# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
+#
+# html_search_language = 'en'
+
+# A dictionary with options for the search language support, empty by default.
+# 'ja' uses this config value.
+# 'zh' user can custom change `jieba` dictionary path.
+#
+# html_search_options = {'type': 'default'}
+
+# The name of a javascript file (relative to the configuration directory) that
+# implements a search results scorer. If empty, the default will be used.
+#
+# html_search_scorer = 'scorer.js'
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'OPNFVFunctestdoc'
+
+# -- Options for LaTeX output ---------------------------------------------
+
+latex_elements = {
+ # The paper size ('letterpaper' or 'a4paper').
+ #
+ # 'papersize': 'letterpaper',
+
+ # The font size ('10pt', '11pt' or '12pt').
+ #
+ # 'pointsize': '10pt',
+
+ # Additional stuff for the LaTeX preamble.
+ #
+ # 'preamble': '',
+
+ # Latex figure (float) alignment
+ #
+ # 'figure_align': 'htbp',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+# author, documentclass [howto, manual, or own class]).
+latex_documents = [
+ (master_doc, 'OPNFVFunctest.tex', u'OPNFV Functest Documentation',
+ u'\\#opnfv-functest (chat.freenode.net)', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#
+# latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#
+# latex_use_parts = False
+
+# If true, show page references after internal links.
+#
+# latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#
+# latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#
+# latex_appendices = []
+
+# It false, will not define \strong, \code, itleref, \crossref ... but only
+# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
+# packages.
+#
+# latex_keep_old_macro_names = True
+
+# If false, no module index is generated.
+#
+# latex_domain_indices = True
+
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ (master_doc, 'opnfvfunctest', u'OPNFV Functest Documentation',
+ [author], 1)
+]
+
+# If true, show URL addresses after external links.
+#
+# man_show_urls = False
+
+
+# -- Options for Texinfo output -------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ (master_doc, 'OPNFVFunctest', u'OPNFV Functest Documentation',
+ author, 'OPNFVFunctest', 'One line description of project.',
+ 'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#
+# texinfo_appendices = []
+
+# If false, no module index is generated.
+#
+# texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#
+# texinfo_show_urls = 'footnote'
+
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+#
+# texinfo_no_detailmenu = False
diff --git a/docs/api/index.rst b/docs/api/index.rst
new file mode 100644
index 000000000..db2234370
--- /dev/null
+++ b/docs/api/index.rst
@@ -0,0 +1,18 @@
+Welcome to OPNFV Functest's documentation!
+==========================================
+
+Contents:
+
+.. toctree::
+ :maxdepth: 2
+
+ apidoc/modules
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
diff --git a/docs/testing/user/userguide/index.rst b/docs/testing/user/userguide/index.rst
index 590043879..c1faecdaa 100644
--- a/docs/testing/user/userguide/index.rst
+++ b/docs/testing/user/userguide/index.rst
@@ -645,7 +645,7 @@ References
`Functest page`_
-IRC support chan: #opnfv-testperf
+IRC support chan: #opnfv-functest
.. _`OPNFV main site`: http://www.opnfv.org
.. _`Functest page`: https://wiki.opnfv.org/functest
diff --git a/functest/ci/check_os.sh b/functest/ci/check_os.sh
index 3920b7ac6..83f9f476d 100755
--- a/functest/ci/check_os.sh
+++ b/functest/ci/check_os.sh
@@ -69,7 +69,7 @@ fi
echo "Checking OpenStack endpoints:"
publicURL=$(openstack catalog show identity |awk '/public/ {print $4}')
publicIP=$(echo $publicURL|sed 's/^.*http.*\:\/\///'|sed 's/.[^:]*$//')
-publicPort=$(echo $publicURL|sed 's/^.*://'|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..."
@@ -93,7 +93,7 @@ if [ -z ${adminURL} ]; then
exit 1
fi
adminIP=$(echo $adminURL|sed 's/^.*http.*\:\/\///'|sed 's/.[^:]*$//')
-adminPort=$(echo $adminURL|sed 's/^.*://'|sed 's/.[^\/]*$//')
+adminPort=$(echo $adminURL|grep -Po '(?<=:)\d+')
https_enabled=$(echo $adminURL | grep 'https')
if [[ -n $https_enabled ]]; then
echo ">>Verifying SSL connectivity to the admin endpoint $adminIP:$adminPort..."
diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml
index 95a4408a1..f291cf1f6 100755..100644
--- a/functest/ci/config_functest.yaml
+++ b/functest/ci/config_functest.yaml
@@ -125,7 +125,7 @@ rally:
router_name: rally-router
refstack:
- tempest_conf_path: openstack/refstack_client/tempest.conf
+ tempest_conf_path: openstack/refstack_client/refstack_tempest.conf
defcore_list: openstack/refstack_client/defcore.txt
vnf:
@@ -201,6 +201,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
+ # you can also set a file (e.g. /home/opnfv/functest/results/dump.txt) to dump results
+ # test_db_url: file:///home/opnfv/functest/results/dump.txt
+ test_db_url: http://testresults.opnfv.org/test/api/v1/results
diff --git a/functest/ci/config_patch.yaml b/functest/ci/config_patch.yaml
index d984a3f47..d47766b64 100755..100644
--- a/functest/ci/config_patch.yaml
+++ b/functest/ci/config_patch.yaml
@@ -22,3 +22,7 @@ ovs:
tempest:
use_custom_images: True
use_custom_flavors: True
+multisite:
+ tempest:
+ use_custom_images: True
+ use_custom_flavors: True
diff --git a/functest/ci/installer_params.yaml b/functest/ci/installer_params.yaml
index 26aff9bb9..77e9355f8 100644
--- a/functest/ci/installer_params.yaml
+++ b/functest/ci/installer_params.yaml
@@ -2,10 +2,10 @@ apex:
ip: ''
user: 'stack'
pkey: '/root/.ssh/id_rsa'
-# compass:
-# ip: '192.168.200.2'
-# user: 'root'
-# password: 'root'
+compass:
+ ip: '192.168.200.2'
+ user: 'root'
+ password: 'root'
fuel:
ip: '10.20.0.2'
user: 'root'
diff --git a/functest/ci/rally_aarch64_patch.conf b/functest/ci/rally_aarch64_patch.conf
index a49588bf8..e5cae8137 100644
--- a/functest/ci/rally_aarch64_patch.conf
+++ b/functest/ci/rally_aarch64_patch.conf
@@ -1,5 +1,5 @@
img_name_regex = ^TestVM$
img_url = http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-disk.img
-flavor_ref_ram = 128
+flavor_ref_ram = 256
flavor_ref_alt_ram = 256
-heat_instance_type_ram = 128
+heat_instance_type_ram = 256
diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py
index 5793c04a7..e68901b89 100755
--- a/functest/ci/run_tests.py
+++ b/functest/ci/run_tests.py
@@ -144,7 +144,8 @@ def run_test(test, tier_name, testcases=None):
try:
module = importlib.import_module(run_dict['module'])
cls = getattr(module, run_dict['class'])
- test_case = cls(case_name=test_name)
+ test_dict = ft_utils.get_dict_by_test(test_name)
+ test_case = cls(**test_dict)
try:
kwargs = run_dict['args']
@@ -154,7 +155,7 @@ def run_test(test, tier_name, testcases=None):
if result == testcase.TestCase.EX_OK:
if GlobalVariables.REPORT_FLAG:
test_case.push_to_db()
- result = test_case.check_criteria()
+ result = test_case.check_result()
except ImportError:
logger.exception("Cannot import module {}".format(
run_dict['module']))
diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml
index 23b214bb7..7009e910c 100755..100644
--- a/functest/ci/testcases.yaml
+++ b/functest/ci/testcases.yaml
@@ -8,8 +8,9 @@ tiers:
operations in the VIM.
testcases:
-
- name: connection_check
- criteria: 'status == "PASS"'
+ case_name: connection_check
+ project_name: functest
+ criteria: 100
blocking: true
clean_flag: false
description: >-
@@ -27,8 +28,9 @@ tiers:
class: 'ConnectionCheck'
-
- name: api_check
- criteria: 'status == "PASS"'
+ case_name: api_check
+ project_name: functest
+ criteria: 100
blocking: true
clean_flag: false
description: >-
@@ -45,8 +47,9 @@ tiers:
module: 'functest.opnfv_tests.openstack.snaps.api_check'
class: 'ApiCheck'
-
- name: snaps_health_check
- criteria: 'status == "PASS"'
+ case_name: snaps_health_check
+ project_name: functest
+ criteria: 100
blocking: true
clean_flag: false
description: >-
@@ -68,8 +71,9 @@ tiers:
Set of basic Functional tests to validate the OPNFV scenarios.
testcases:
-
- name: vping_ssh
- criteria: 'status == "PASS"'
+ case_name: vping_ssh
+ project_name: functest
+ criteria: 100
blocking: true
clean_flag: true
description: >-
@@ -84,8 +88,9 @@ tiers:
class: 'VPingSSH'
-
- name: vping_userdata
- criteria: 'status == "PASS"'
+ case_name: vping_userdata
+ project_name: functest
+ criteria: 100
blocking: true
clean_flag: true
description: >-
@@ -99,8 +104,9 @@ tiers:
class: 'VPingUserdata'
-
- name: tempest_smoke_serial
- criteria: 'success_rate == 100%'
+ case_name: tempest_smoke_serial
+ project_name: functest
+ criteria: 100
blocking: false
clean_flag: true
description: >-
@@ -116,8 +122,9 @@ tiers:
class: 'TempestSmokeSerial'
-
- name: rally_sanity
- criteria: 'success_rate == 100%'
+ case_name: rally_sanity
+ project_name: functest
+ criteria: 100
blocking: false
clean_flag: false
description: >-
@@ -131,8 +138,9 @@ tiers:
class: 'RallySanity'
-
- name: refstack_defcore
- criteria: 'success_rate == 100%'
+ case_name: refstack_defcore
+ project_name: functest
+ criteria: 100
blocking: false
clean_flag: true
description: >-
@@ -146,8 +154,9 @@ tiers:
class: 'RefstackClient'
-
- name: odl
- criteria: 'success_rate == 100%'
+ case_name: odl
+ project_name: functest
+ criteria: 100
blocking: true
clean_flag: false
description: >-
@@ -166,8 +175,9 @@ tiers:
- /home/opnfv/repos/odl_test/csit/suites/openstack/neutron
-
- name: odl_netvirt
- criteria: 'success_rate == 100%'
+ case_name: odl_netvirt
+ project_name: functest
+ criteria: 100
blocking: false
clean_flag: false
description: >-
@@ -188,8 +198,9 @@ tiers:
- /home/opnfv/repos/odl_test/csit/suites/openstack/connectivity
-
- name: fds
- criteria: 'success_rate == 100%'
+ case_name: fds
+ project_name: functest
+ criteria: 100
blocking: false
clean_flag: false
description: >-
@@ -207,8 +218,9 @@ tiers:
- /home/opnfv/repos/fds/testing/robot
-
- name: onos
- criteria: 'status == "PASS"'
+ case_name: onos
+ project_name: functest
+ criteria: 100
blocking: true
clean_flag: true
description: >-
@@ -223,8 +235,9 @@ tiers:
class: 'Onos'
-
- name: snaps_smoke
- criteria: 'status == "PASS"'
+ case_name: snaps_smoke
+ project_name: functest
+ criteria: 100
blocking: false
clean_flag: false
description: >-
@@ -252,8 +265,9 @@ tiers:
integrated in functest
testcases:
-
- name: promise
- criteria: 'success_rate == 100%'
+ case_name: promise
+ project_name: promise
+ criteria: 100
blocking: false
clean_flag: true
description: >-
@@ -262,12 +276,15 @@ tiers:
installer: '(fuel)|(joid)'
scenario: ''
run:
- module: 'functest.opnfv_tests.features.promise'
- class: 'Promise'
+ module: 'functest.core.feature'
+ class: 'BashFeature'
+ args:
+ cmd: 'cd /home/opnfv/repos/promise/promise/test/functest && python ./run_tests.py'
-
- name: doctor
- criteria: 'status == "PASS"'
+ case_name: doctor-notification
+ project_name: doctor
+ criteria: 100
blocking: false
clean_flag: true
description: >-
@@ -276,12 +293,15 @@ tiers:
installer: '(apex)|(fuel)'
scenario: '^((?!fdio).)*$'
run:
- module: 'functest.opnfv_tests.features.doctor'
- class: 'Doctor'
+ module: 'functest.core.feature'
+ class: 'BashFeature'
+ args:
+ cmd: 'cd /home/opnfv/repos/doctor/tests && ./run.sh'
-
- name: bgpvpn
- criteria: 'status == "PASS"'
+ case_name: bgpvpn
+ project_name: sdnvpn
+ criteria: 100
blocking: false
clean_flag: true
description: >-
@@ -290,12 +310,15 @@ tiers:
installer: '(fuel)|(apex)|(netvirt)'
scenario: 'bgpvpn'
run:
- module: 'functest.opnfv_tests.features.sdnvpn'
- class: 'SdnVpnTests'
+ module: 'functest.core.feature'
+ class: 'BashFeature'
+ args:
+ cmd: 'cd /home/opnfv/repos/sdnvpn/sdnvpn/test/functest && python ./run_tests.py'
-
- name: security_scan
- criteria: 'status == "PASS"'
+ case_name: security_scan
+ project_name: securityscanning
+ criteria: 100
blocking: false
clean_flag: true
description: >-
@@ -304,12 +327,32 @@ tiers:
installer: 'apex'
scenario: '^((?!fdio).)*$'
run:
- module: 'functest.opnfv_tests.features.security_scan'
- class: 'SecurityScan'
+ module: 'functest.core.feature'
+ class: 'BashFeature'
+ args:
+ cmd: '. /home/opnfv/functest/conf/stackrc && cd /home/opnfv/repos/securityscanning && python security_scan.py --config config.ini && cd -'
+
+ -
+ case_name: copper
+ project_name: copper
+ criteria: 100
+ blocking: false
+ clean_flag: true
+ description: >-
+ Test suite for policy management based on OpenStack Congress
+ dependencies:
+ installer: 'apex'
+ scenario: '^((?!fdio).)*$'
+ run:
+ module: 'functest.core.feature'
+ class: 'BashFeature'
+ args:
+ cmd: 'cd /home/opnfv/repos/copper/tests && bash run.sh && cd -'
-
- name: multisite
- criteria: 'success_rate == 100%'
+ case_name: multisite
+ project_name: multisite
+ criteria: 100
blocking: false
clean_flag: false
description: >-
@@ -321,8 +364,9 @@ tiers:
module: 'functest.opnfv_tests.openstack.tempest.tempest'
class: 'TempestMultisite'
-
- name: odl-sfc
- criteria: 'status == "PASS"'
+ case_name: functest-odl-sfc
+ project_name: sfc
+ criteria: 100
blocking: false
clean_flag: true
description: >-
@@ -331,11 +375,14 @@ tiers:
installer: '(apex)|(fuel)'
scenario: 'odl_l2-sfc'
run:
- module: 'functest.opnfv_tests.features.odl_sfc'
- class: 'OpenDaylightSFC'
+ module: 'functest.core.feature'
+ class: 'BashFeature'
+ args:
+ cmd: 'cd /home/opnfv/repos/sfc/sfc/tests/functest && python ./run_tests.py'
-
- name: onos_sfc
- criteria: 'status == "PASS"'
+ case_name: onos_sfc
+ project_name: functest
+ criteria: 100
blocking: true
clean_flag: true
description: >-
@@ -347,8 +394,9 @@ tiers:
module: 'functest.opnfv_tests.sdn.onos.onos'
class: 'OnosSfc'
-
- name: parser
- criteria: 'ret == 0'
+ case_name: parser-basics
+ project_name: parser
+ criteria: 100
blocking: false
clean_flag: true
description: >-
@@ -357,11 +405,14 @@ tiers:
installer: 'fuel'
scenario: '^((?!bgpvpn|noha).)*$'
run:
- module: 'functest.opnfv_tests.vnf.rnc.parser'
- class: 'Parser'
+ module: 'functest.core.feature'
+ class: 'BashFeature'
+ args:
+ cmd: 'cd /home/opnfv/repos/parser/tests && ./functest_run.sh'
-
- name: domino
- criteria: 'status == "PASS"'
+ case_name: domino-multinode
+ project_name: domino
+ criteria: 100
blocking: false
clean_flag: true
description: >-
@@ -370,11 +421,14 @@ tiers:
installer: ''
scenario: ''
run:
- module: 'functest.opnfv_tests.features.domino'
- class: 'Domino'
+ module: 'functest.core.feature'
+ class: 'BashFeature'
+ args:
+ cmd: 'cd /home/opnfv/repos/domino && ./tests/run_multinode.sh'
-
- name: netready
- criteria: 'status == "PASS"'
+ case_name: gluon_vping
+ project_name: netready
+ criteria: 100
blocking: false
clean_flag: true
description: >-
@@ -383,11 +437,14 @@ tiers:
installer: 'apex'
scenario: 'gluon'
run:
- module: 'functest.opnfv_tests.features.netready'
- class: 'GluonVping'
+ module: 'functest.core.feature'
+ class: 'BashFeature'
+ args:
+ cmd: 'cd /home/opnfv/repos/netready/test/functest && python ./gluon-test-suite.py'
-
- name: barometer
- criteria: 'status == "PASS"'
+ case_name: barometercollectd
+ project_name: barometer
+ criteria: 100
blocking: false
clean_flag: true
description: >-
@@ -409,8 +466,9 @@ tiers:
Extensive testing of OpenStack API.
testcases:
-
- name: tempest_full_parallel
- criteria: 'success_rate >= 80%'
+ case_name: tempest_full_parallel
+ project_name: functest
+ criteria: 80
blocking: false
clean_flag: true
description: >-
@@ -424,8 +482,9 @@ tiers:
module: 'functest.opnfv_tests.openstack.tempest.tempest'
class: 'TempestFullParallel'
-
- name: tempest_custom
- criteria: 'success_rate == 100%'
+ case_name: tempest_custom
+ project_name: functest
+ criteria: 100
blocking: false
clean_flag: true
description: >-
@@ -441,8 +500,9 @@ tiers:
module: 'functest.opnfv_tests.openstack.tempest.tempest'
class: 'TempestCustom'
-
- name: rally_full
- criteria: 'success_rate >= 90%'
+ case_name: rally_full
+ project_name: functest
+ criteria: 90
blocking: false
clean_flag: false
description: >-
@@ -463,8 +523,9 @@ tiers:
Collection of VNF test cases.
testcases:
-
- name: cloudify_ims
- criteria: 'status == "PASS"'
+ case_name: cloudify_ims
+ project_name: functest
+ criteria: 100
blocking: false
clean_flag: true
description: >-
@@ -477,8 +538,9 @@ tiers:
module: 'functest.opnfv_tests.vnf.ims.cloudify_ims'
class: 'CloudifyIms'
# -
-# name: aaa
-# criteria: 'ret == 0'
+# case_name: aaa
+# project_name: functest
+# criteria: 100
# blocking: false
# clean_flag: true
# description: >-
@@ -490,8 +552,9 @@ tiers:
# module: 'functest.opnfv_tests.vnf.aaa.aaa'
# class: 'AaaVnf'
-
- name: orchestra_ims
- criteria: 'ret == 0'
+ case_name: orchestra_ims
+ project_name: functest
+ criteria: 100
blocking: false
clean_flag: true
description: >-
@@ -504,22 +567,24 @@ tiers:
class: 'ImsVnf'
-
- name: opera_ims
- criteria: 'status == "PASS"'
+ case_name: opera_vims
+ project_name: opera
+ criteria: 100
blocking: false
clean_flag: true
description: >-
VNF deployment with OPEN-O
dependencies:
- installer: 'unknown'
- scenario: 'unknown'
+ installer: 'compass'
+ scenario: 'os-nosdn-openo-ha'
run:
module: 'functest.opnfv_tests.vnf.ims.opera_ims'
class: 'OperaIms'
-
- name: vyos_vrouter
- criteria: 'status == "PASS"'
+ case_name: vyos_vrouter
+ project_name: functest
+ criteria: 100
blocking: false
clean_flag: true
description: >-
diff --git a/functest/ci/tier_builder.py b/functest/ci/tier_builder.py
index f4c6f70fd..44b272584 100644
--- a/functest/ci/tier_builder.py
+++ b/functest/ci/tier_builder.py
@@ -46,7 +46,7 @@ class TierBuilder(object):
scenario = dic_testcase['dependencies']['scenario']
dep = th.Dependency(installer, scenario)
- testcase = th.TestCase(name=dic_testcase['name'],
+ testcase = th.TestCase(name=dic_testcase['case_name'],
dependency=dep,
criteria=dic_testcase['criteria'],
blocking=dic_testcase['blocking'],
diff --git a/functest/ci/tier_handler.py b/functest/ci/tier_handler.py
index 6b4864b5b..fe7372a38 100644
--- a/functest/ci/tier_handler.py
+++ b/functest/ci/tier_handler.py
@@ -158,7 +158,7 @@ class TestCase(object):
for line in lines:
out += ("| " + line.ljust(LINE_LENGTH - 7) + " |\n")
out += ("| Criteria: " +
- self.criteria.ljust(LINE_LENGTH - 14) + "|\n")
+ str(self.criteria).ljust(LINE_LENGTH - 14) + "|\n")
out += ("| Dependencies:".ljust(LINE_LENGTH - 1) + "|\n")
installer = self.dependency.get_installer()
scenario = self.dependency.get_scenario()
diff --git a/functest/core/feature.py b/functest/core/feature.py
index 5149f80fd..d65f5a3c1 100644
--- a/functest/core/feature.py
+++ b/functest/core/feature.py
@@ -1,62 +1,114 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2016 ZTE Corp 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
+
+"""Define the parent class of all Functest Features.
+
+Feature is considered as TestCase offered by Third-party. It offers
+helpers to run any python method or any bash command.
+"""
+
import time
-import testcase as base
+import functest.core.testcase as base
import functest.utils.functest_utils as ft_utils
import functest.utils.functest_logger as ft_logger
from functest.utils.constants import CONST
+__author__ = ("Serena Feng <feng.xiaowei@zte.com.cn>, "
+ "Cedric Ollivier <cedric.ollivier@orange.com>")
+
class Feature(base.TestCase):
+ """Base model for single feature."""
+
+ def __init__(self, **kwargs):
+ super(Feature, self).__init__(**kwargs)
+ self.result_file = "{}/{}.log".format(
+ CONST.__getattribute__('dir_results'), self.project_name)
+ self.logger = ft_logger.Logger(self.project_name).getLogger()
+
+ def execute(self, **kwargs):
+ """Execute the Python method.
+
+ The subclasses must override the default implementation which
+ is false on purpose.
+
+ The new implementation must return 0 if success or anything
+ else if failure.
+
+ Args:
+ kwargs: Arbitrary keyword arguments.
- def __init__(self, project='functest', case_name='', repo='', cmd=''):
- super(Feature, self).__init__(case_name=case_name)
- self.project_name = project
- self.cmd = cmd
- self.repo = CONST.__getattribute__(repo)
- self.result_file = self.get_result_file()
- self.logger = ft_logger.Logger(project).getLogger()
+ Returns:
+ -1.
+ """
+ # pylint: disable=unused-argument,no-self-use
+ return -1
def run(self, **kwargs):
- self.prepare()
+ """Run the feature.
+
+ It allows executing any Python method by calling execute().
+
+ It sets the following attributes required to push the results
+ to DB:
+
+ * result,
+ * start_time,
+ * stop_time.
+
+ It doesn't fulfill details when pushing the results to the DB.
+
+ Args:
+ kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ TestCase.EX_OK if execute() returns 0,
+ TestCase.EX_RUN_ERROR otherwise.
+ """
self.start_time = time.time()
- ret = self.execute()
+ exit_code = base.TestCase.EX_RUN_ERROR
+ self.result = 0
+ try:
+ if self.execute(**kwargs) == 0:
+ exit_code = base.TestCase.EX_OK
+ self.result = 100
+ ft_utils.logger_test_results(
+ self.project_name, self.case_name,
+ self.result, self.details)
+ self.logger.info("%s %s", self.project_name, self.result)
+ except Exception: # pylint: disable=broad-except
+ self.logger.exception("%s FAILED", self.project_name)
+ self.logger.info("Test result is stored in '%s'", self.result_file)
self.stop_time = time.time()
- self.post()
- self.parse_results(ret)
- self.log_results()
- self.logger.info("Test result is stored in '%s'" % self.result_file)
- return base.TestCase.EX_OK
-
- def execute(self):
- '''
- Executer method that can be overwritten
- By default it executes a shell command.
- '''
- return ft_utils.execute_command(self.cmd, output_file=self.result_file)
-
- def prepare(self, **kwargs):
- pass
-
- def post(self, **kwargs):
- pass
-
- def parse_results(self, ret):
- exit_code = base.TestCase.EX_OK
- if ret == 0:
- self.logger.info("{} OK".format(self.project_name))
- self.criteria = 'PASS'
- else:
- self.logger.info("{} FAILED".format(self.project_name))
- exit_code = base.TestCase.EX_RUN_ERROR
- self.criteria = "FAIL"
-
return exit_code
- def get_result_file(self):
- return "{}/{}.log".format(CONST.dir_results, self.project_name)
- def log_results(self):
- ft_utils.logger_test_results(self.project_name,
- self.case_name,
- self.criteria,
- self.details)
+class BashFeature(Feature):
+ """Class designed to run any bash command."""
+
+ def execute(self, **kwargs):
+ """Execute the cmd passed as arg
+
+ Args:
+ kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ 0 if cmd returns 0,
+ -1 otherwise.
+ """
+ ret = -1
+ try:
+ cmd = kwargs["cmd"]
+ ret = ft_utils.execute_command(cmd, output_file=self.result_file)
+ except KeyError:
+ self.logger.error("Please give cmd as arg. kwargs: %s", kwargs)
+ except Exception: # pylint: disable=broad-except
+ self.logger.exception("Execute cmd: %s failed", cmd)
+ return ret
diff --git a/functest/core/pytest_suite_runner.py b/functest/core/pytest_suite_runner.py
index 9cfaea7ae..8b5da05ef 100644
--- a/functest/core/pytest_suite_runner.py
+++ b/functest/core/pytest_suite_runner.py
@@ -15,8 +15,8 @@ class PyTestSuiteRunner(base.TestCase):
This superclass is designed to execute pre-configured unittest.TestSuite()
objects
"""
- def __init__(self, case_name=''):
- super(PyTestSuiteRunner, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ super(PyTestSuiteRunner, self).__init__(**kwargs)
self.suite = None
def run(self, **kwargs):
@@ -48,10 +48,10 @@ class PyTestSuiteRunner(base.TestCase):
if ((result.errors and len(result.errors) > 0)
or (result.failures and len(result.failures) > 0)):
self.logger.info("%s FAILED" % self.case_name)
- self.criteria = 'FAIL'
+ self.result = 'FAIL'
else:
self.logger.info("%s OK" % self.case_name)
- self.criteria = 'PASS'
+ self.result = 'PASS'
self.details = {}
return exit_code
diff --git a/functest/core/testcase.py b/functest/core/testcase.py
index 8c5fd6476..3f191b407 100644
--- a/functest/core/testcase.py
+++ b/functest/core/testcase.py
@@ -7,7 +7,7 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
-"""Define the parent class of Functest TestCase."""
+"""Define the parent class of all Functest TestCases."""
import os
@@ -18,59 +18,79 @@ __author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
class TestCase(object):
- """Parent class of Functest TestCase."""
+ """Base model for single test case."""
EX_OK = os.EX_OK
+ """everything is OK"""
+
EX_RUN_ERROR = os.EX_SOFTWARE
+ """run() failed"""
+
EX_PUSH_TO_DB_ERROR = os.EX_SOFTWARE - 1
+ """push_to_db() failed"""
+
EX_TESTCASE_FAILED = os.EX_SOFTWARE - 2
+ """results are false"""
logger = ft_logger.Logger(__name__).getLogger()
- def __init__(self, case_name=""):
+ def __init__(self, **kwargs):
self.details = {}
- self.project_name = "functest"
- self.case_name = case_name
- self.criteria = ""
+ self.project_name = kwargs.get('project_name', 'functest')
+ self.case_name = kwargs.get('case_name', '')
+ self.criteria = kwargs.get('criteria', 100)
+ self.result = ""
self.start_time = ""
self.stop_time = ""
- def check_criteria(self):
- """Interpret the results of TestCase.
+ def check_result(self):
+ """Interpret the result of the test case.
- It allows getting the results of TestCase. It completes run()
+ It allows getting the result of TestCase. It completes run()
which only returns the execution status.
- It can be overriden if checking criteria is not suitable.
+ It can be overriden if checking result is not suitable.
Returns:
- TestCase.EX_OK if criteria is 'PASS'.
+ TestCase.EX_OK if result is 'PASS'.
TestCase.EX_TESTCASE_FAILED otherwise.
"""
try:
assert self.criteria
- if self.criteria == 'PASS':
- return TestCase.EX_OK
+ if isinstance(self.result, int) and isinstance(self.criteria, int):
+ if self.result >= self.criteria:
+ return TestCase.EX_OK
+ else:
+ # Backward compatibility
+ # It must be removed as soon as TestCase subclasses
+ # stop setting result = 'PASS' or 'FAIL'.
+ # In this case criteria is unread.
+ self.logger.warning(
+ "Please update result which must be an int!")
+ if self.result == 'PASS':
+ return TestCase.EX_OK
except AssertionError:
self.logger.error("Please run test before checking the results")
return TestCase.EX_TESTCASE_FAILED
def run(self, **kwargs):
- """Run TestCase.
+ """Run the test case.
It allows running TestCase and getting its execution
status.
The subclasses must override the default implementation which
- is false on purpose. The only prerequisite is to set the
- following attributes to push the results to DB:
- * case_name,
- * criteria,
+ is false on purpose.
+
+ The new implementation must set the following attributes to
+ push the results to DB:
+
+ * result,
* start_time,
* stop_time.
Args:
- **kwargs: Arbitrary keyword arguments.
+ kwargs: Arbitrary keyword arguments.
Returns:
TestCase.EX_RUN_ERROR.
@@ -80,16 +100,17 @@ class TestCase(object):
return TestCase.EX_RUN_ERROR
def push_to_db(self):
- """Push the results of TestCase to the DB.
+ """Push the results of the test case to the DB.
It allows publishing the results and to check the status.
It could be overriden if the common implementation is not
suitable. The following attributes must be set before pushing
the results to DB:
+
* project_name,
* case_name,
- * criteria,
+ * result,
* start_time,
* stop_time.
@@ -100,12 +121,13 @@ class TestCase(object):
try:
assert self.project_name
assert self.case_name
- assert self.criteria
assert self.start_time
assert self.stop_time
+ pub_result = 'PASS' if self.check_result(
+ ) == TestCase.EX_OK else 'FAIL'
if ft_utils.push_results_to_db(
self.project_name, self.case_name, self.start_time,
- self.stop_time, self.criteria, self.details):
+ self.stop_time, pub_result, self.details):
self.logger.info("The results were successfully pushed to DB")
return TestCase.EX_OK
else:
diff --git a/functest/core/vnf_base.py b/functest/core/vnf_base.py
index 3d3a441f4..fe4e427fa 100644
--- a/functest/core/vnf_base.py
+++ b/functest/core/vnf_base.py
@@ -21,13 +21,18 @@ class VnfOnBoardingBase(base.TestCase):
logger = ft_logger.Logger(__name__).getLogger()
- def __init__(self, project='functest', case_name='', repo='', cmd=''):
- super(VnfOnBoardingBase, self).__init__(case_name=case_name)
- self.repo = repo
- self.project_name = project
- self.cmd = cmd
+ def __init__(self, **kwargs):
+ super(VnfOnBoardingBase, self).__init__(**kwargs)
+ self.repo = kwargs.get('repo', '')
+ self.cmd = kwargs.get('cmd', '')
self.details = {}
self.result_dir = CONST.dir_results
+ self.details_step_mapping = dict(
+ deploy_orchestrator='orchestrator',
+ deploy_vnf='vnf',
+ test_vnf='test_vnf',
+ prepare='prepare_env')
+ self.details['prepare_env'] = {}
self.details['orchestrator'] = {}
self.details['vnf'] = {}
self.details['test_vnf'] = {}
@@ -110,7 +115,7 @@ class VnfOnBoardingBase(base.TestCase):
# prepare state could consist in the creation of the resources
# a dedicated user
- # a dedictaed tenant
+ # a dedicated tenant
# dedicated images
def prepare(self):
self.creds = os_utils.get_credentials()
@@ -119,48 +124,45 @@ class VnfOnBoardingBase(base.TestCase):
self.logger.info("Prepare OpenStack plateform(create tenant and user)")
admin_user_id = os_utils.get_user_id(self.keystone_client,
self.creds['username'])
- if admin_user_id == '':
- self.step_failure("Failed to get id of " +
- self.creds['username'])
+ if not admin_user_id:
+ self.step_failure("Failed to get id of {0}".format(
+ self.creds['username']))
- tenant_id = os_utils.create_tenant(
- self.keystone_client, self.tenant_name, self.tenant_description)
+ tenant_id = os_utils.get_tenant_id(self.keystone_client,
+ self.tenant_name)
if not tenant_id:
- self.step_failure("Failed to create " +
- self.tenant_name + " tenant")
-
- roles_name = ["admin", "Admin"]
- role_id = ''
- for role_name in roles_name:
- if role_id == '':
- role_id = os_utils.get_role_id(self.keystone_client, role_name)
-
- if role_id == '':
- self.logger.error("Failed to get id for %s role" % role_name)
- self.step_failure("Failed to get role id of " + role_name)
-
- if not os_utils.add_role_user(self.keystone_client, admin_user_id,
- role_id, tenant_id):
- self.logger.error("Failed to add %s on tenant" %
- self.creds['username'])
- self.step_failure("Failed to add %s on tenant" %
- self.creds['username'])
-
- user_id = os_utils.create_user(self.keystone_client,
- self.tenant_name,
- self.tenant_name,
- None,
- tenant_id)
+ tenant_id = os_utils.create_tenant(self.keystone_client,
+ self.tenant_name,
+ self.tenant_description)
+ if not tenant_id:
+ self.step_failure("Failed to get or create {0} tenant".format(
+ self.tenant_name))
+ roles_name = ["admin", "Admin"]
+ role_id = ''
+ for role_name in roles_name:
+ if not role_id:
+ role_id = os_utils.get_role_id(self.keystone_client,
+ role_name)
+
+ if not role_id:
+ self.step_failure("Failed to get id for {0} role".format(
+ role_name))
+
+ if not os_utils.add_role_user(self.keystone_client, admin_user_id,
+ role_id, tenant_id):
+ self.step_failure("Failed to add {0} on tenant".format(
+ self.creds['username']))
+
+ user_id = os_utils.get_or_create_user(self.keystone_client,
+ self.tenant_name,
+ self.tenant_name,
+ tenant_id)
if not user_id:
- self.logger.error("Failed to create %s user" % self.tenant_name)
- self.step_failure("Failed to create user ")
+ self.step_failure("Failed to get or create {0} user".format(
+ self.tenant_name))
- if not os_utils.add_role_user(self.keystone_client, user_id,
- role_id, tenant_id):
- self.logger.error("Failed to add %s on tenant" %
- self.tenant_name)
- self.step_failure("Failed to add %s on tenant" %
- self.tenant_name)
+ os_utils.add_role_user(self.keystone_client, user_id,
+ role_id, tenant_id)
self.logger.info("Update OpenStack creds informations")
self.admin_creds = self.creds.copy()
@@ -175,7 +177,7 @@ class VnfOnBoardingBase(base.TestCase):
"password": self.tenant_name,
})
- # orchestrator is not mandatory to dpeloy and test VNF
+ # orchestrator is not mandatory to deploy and test VNF
def deploy_orchestrator(self, **kwargs):
pass
@@ -188,53 +190,33 @@ class VnfOnBoardingBase(base.TestCase):
self.logger.error("VNF must be tested")
raise Exception("VNF not tested")
+ # clean before openstack clean run
def clean(self):
self.logger.info("test cleaning")
- self.logger.info("Removing %s tenant .." % self.tenant_name)
- tenant_id = os_utils.get_tenant_id(self.keystone_client,
- self.tenant_name)
- if tenant_id == '':
- self.logger.error("Error : Failed to get id of %s tenant" %
- self.tenant_name)
- else:
- if not os_utils.delete_tenant(self.keystone_client, tenant_id):
- self.logger.error("Error : Failed to remove %s tenant" %
- self.tenant_name)
-
- self.logger.info("Removing %s user .." % self.tenant_name)
- user_id = os_utils.get_user_id(
- self.keystone_client, self.tenant_name)
- if user_id == '':
- self.logger.error("Error : Failed to get id of %s user" %
- self.tenant_name)
- else:
- if not os_utils.delete_user(self.keystone_client, user_id):
- self.logger.error("Error : Failed to remove %s user" %
- self.tenant_name)
-
def parse_results(self):
exit_code = self.EX_OK
- self.criteria = "PASS"
+ self.result = "PASS"
self.logger.info(self.details)
# The 2 VNF steps must be OK to get a PASS result
if (self.details['vnf']['status'] is not "PASS" or
self.details['test_vnf']['status'] is not "PASS"):
exit_code = self.EX_RUN_ERROR
- self.criteria = "FAIL"
+ self.result = "FAIL"
return exit_code
def log_results(self):
ft_utils.logger_test_results(self.project_name,
self.case_name,
- self.criteria,
+ self.result,
self.details)
def step_failure(self, error_msg):
part = inspect.stack()[1][3]
- self.logger.error("Step '%s' failed: %s", part, error_msg)
+ self.logger.error("Step {0} failed: {1}".format(part, error_msg))
try:
- part_info = self.details[part]
+ step_name = self.details_step_mapping[part]
+ part_info = self.details[step_name]
except KeyError:
self.details[part] = {}
part_info = self.details[part]
diff --git a/functest/opnfv_tests/features/barometer.py b/functest/opnfv_tests/features/barometer.py
index 6207f5814..8a409406b 100644
--- a/functest/opnfv_tests/features/barometer.py
+++ b/functest/opnfv_tests/features/barometer.py
@@ -16,10 +16,5 @@ class BarometerCollectd(base.Feature):
Class for executing barometercollectd testcase.
'''
- def __init__(self, case_name='barometercollectd'):
- super(BarometerCollectd, self).__init__(project='barometer',
- case_name=case_name,
- repo='dir_repo_barometer')
-
def execute(self):
return collectd.main(self.logger)
diff --git a/functest/opnfv_tests/features/copper.py b/functest/opnfv_tests/features/copper.py
deleted file mode 100644
index 5b88a4995..000000000
--- a/functest/opnfv_tests/features/copper.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2016 AT&T Intellectual Property, Inc
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-import functest.core.feature as base
-
-
-class Copper(base.Feature):
- def __init__(self, case_name='copper-notification'):
- super(Copper, self).__init__(project='copper',
- case_name=case_name,
- repo='dir_repo_copper')
- self.cmd = 'cd %s/tests && bash run.sh && cd -' % self.repo
diff --git a/functest/opnfv_tests/features/doctor.py b/functest/opnfv_tests/features/doctor.py
deleted file mode 100644
index fd181a040..000000000
--- a/functest/opnfv_tests/features/doctor.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2017 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
-#
-# 0.1: This script boots the VM1 and allocates IP address from Nova
-# Later, the VM2 boots then execute cloud-init to ping VM1.
-# After successful ping, both the VMs are deleted.
-# 0.2: measure test duration and publish results under json format
-#
-#
-import functest.core.feature as base
-
-
-class Doctor(base.Feature):
- def __init__(self, case_name='doctor-notification'):
- super(Doctor, self).__init__(project='doctor',
- case_name=case_name,
- repo='dir_repo_doctor')
- self.cmd = 'cd %s/tests && ./run.sh' % self.repo
diff --git a/functest/opnfv_tests/features/domino.py b/functest/opnfv_tests/features/domino.py
deleted file mode 100644
index 1c620235c..000000000
--- a/functest/opnfv_tests/features/domino.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2015 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
-#
-# 0.1: This script boots the VM1 and allocates IP address from Nova
-# Later, the VM2 boots then execute cloud-init to ping VM1.
-# After successful ping, both the VMs are deleted.
-# 0.2: measure test duration and publish results under json format
-# 0.3: add report flag to push results when needed
-# 0.4: refactoring to match Test abstraction class
-
-import functest.core.feature as base
-
-
-class Domino(base.Feature):
- def __init__(self, case_name='domino-multinode'):
- super(Domino, self).__init__(project='domino',
- case_name=case_name,
- repo='dir_repo_domino')
- self.cmd = 'cd %s && ./tests/run_multinode.sh' % self.repo
diff --git a/functest/opnfv_tests/features/netready.py b/functest/opnfv_tests/features/netready.py
deleted file mode 100644
index ada322c18..000000000
--- a/functest/opnfv_tests/features/netready.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/python
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-
-#
-import functest.core.feature as base
-
-
-class GluonVping(base.Feature):
-
- def __init__(self, case_name='gluon_vping'):
- super(GluonVping, self).__init__(project='netready',
- case_name=case_name,
- repo='dir_repo_netready')
- dir_netready_functest = '{}/test/functest'.format(self.repo)
- self.cmd = ('cd %s && python ./gluon-test-suite.py' %
- dir_netready_functest)
diff --git a/functest/opnfv_tests/features/odl_sfc.py b/functest/opnfv_tests/features/odl_sfc.py
deleted file mode 100644
index f96683e36..000000000
--- a/functest/opnfv_tests/features/odl_sfc.py
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2016 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 functest.core.feature as base
-
-
-class OpenDaylightSFC(base.Feature):
-
- def __init__(self, case_name='functest-odl-sfc'):
- super(OpenDaylightSFC, self).__init__(project='sfc',
- case_name=case_name,
- repo='dir_repo_sfc')
- dir_sfc_functest = '{}/sfc/tests/functest'.format(self.repo)
- self.cmd = 'cd %s && python ./run_tests.py' % dir_sfc_functest
diff --git a/functest/opnfv_tests/features/promise.py b/functest/opnfv_tests/features/promise.py
deleted file mode 100644
index e3dc7fdf5..000000000
--- a/functest/opnfv_tests/features/promise.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/python
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-import functest.core.feature as base
-
-
-class Promise(base.Feature):
- def __init__(self, case_name='promise'):
- super(Promise, self).__init__(project='promise',
- case_name=case_name,
- repo='dir_repo_promise')
- dir_promise_functest = '{}/promise/test/functest'.format(self.repo)
- self.cmd = 'cd %s && python ./run_tests.py' % dir_promise_functest
diff --git a/functest/opnfv_tests/features/sdnvpn.py b/functest/opnfv_tests/features/sdnvpn.py
deleted file mode 100644
index 5e9254a0b..000000000
--- a/functest/opnfv_tests/features/sdnvpn.py
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2016 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 functest.core.feature as base
-
-
-class SdnVpnTests(base.Feature):
-
- def __init__(self, case_name='bgpvpn'):
- super(SdnVpnTests, self).__init__(project='sdnvpn',
- case_name=case_name,
- repo='dir_repo_sdnvpn')
- dir_sfc_functest = '{}/sdnvpn/test/functest'.format(self.repo)
- self.cmd = 'cd %s && python ./run_tests.py' % dir_sfc_functest
diff --git a/functest/opnfv_tests/features/security_scan.py b/functest/opnfv_tests/features/security_scan.py
deleted file mode 100644
index e72563808..000000000
--- a/functest/opnfv_tests/features/security_scan.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2015 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 functest.core.feature as base
-from functest.utils.constants import CONST
-
-
-class SecurityScan(base.Feature):
- def __init__(self, case_name='security_scan'):
- super(SecurityScan, self).__init__(project='securityscanning',
- case_name=case_name,
- repo='dir_repo_securityscan')
- self.cmd = ('. {0}/stackrc && '
- 'cd {1} && '
- 'python security_scan.py --config config.ini && '
- 'cd -'.format(CONST.dir_functest_conf,
- self.repo))
diff --git a/functest/opnfv_tests/mano/orchestra.py b/functest/opnfv_tests/mano/orchestra.py
index a9cf0ae66..dea26efc3 100644
--- a/functest/opnfv_tests/mano/orchestra.py
+++ b/functest/opnfv_tests/mano/orchestra.py
@@ -16,9 +16,12 @@ import functest.core.feature as base
class Orchestra(base.Feature):
- def __init__(self):
- super(Orchestra, self).__init__(project='orchestra',
- case='orchestra',
- repo='dir_repo_orchestra')
+ def __init__(self, **kwargs):
+ if "project_name" not in kwargs:
+ kwargs["project_name"] = "orchestra"
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "orchestra"
+ kwargs['repo'] = 'dir_repo_orchestra'
+ super(Orchestra, self).__init__(**kwargs)
# TODO
# self.cmd = "%s/tests/run.sh %s/tests" % (self.repo, self.repo)
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py
index e7411c51d..e07e2a8df 100644
--- a/functest/opnfv_tests/openstack/rally/rally.py
+++ b/functest/opnfv_tests/openstack/rally/rally.py
@@ -56,8 +56,8 @@ class RallyBase(testcase.TestCase):
RALLY_PRIVATE_SUBNET_CIDR = CONST.rally_subnet_cidr
RALLY_ROUTER_NAME = CONST.rally_router_name
- def __init__(self, case_name=''):
- super(RallyBase, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ super(RallyBase, self).__init__(**kwargs)
self.mode = ''
self.summary = []
self.scenario_dir = ''
@@ -500,12 +500,12 @@ class RallyBase(testcase.TestCase):
'nb tests': total_nb_tests,
'nb success': success_rate}})
- self.criteria = ft_utils.check_success_rate(
+ self.result = ft_utils.check_success_rate(
self.case_name, success_rate)
self.details = payload
logger.info("Rally '%s' success_rate is %s%%, is marked as %s"
- % (self.case_name, success_rate, self.criteria))
+ % (self.case_name, success_rate, self.result))
def _clean_up(self):
if self.volume_type:
@@ -536,8 +536,10 @@ class RallyBase(testcase.TestCase):
class RallySanity(RallyBase):
- def __init__(self, case_name="rally_sanity"):
- super(RallySanity, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "rally_sanity"
+ super(RallySanity, self).__init__(**kwargs)
self.mode = 'sanity'
self.test_name = 'all'
self.smoke = True
@@ -545,8 +547,10 @@ class RallySanity(RallyBase):
class RallyFull(RallyBase):
- def __init__(self, case_name="rally_full"):
- super(RallyFull, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "rally_full"
+ super(RallyFull, self).__init__(**kwargs)
self.mode = 'full'
self.test_name = 'all'
self.smoke = False
diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
index 441abfee3..2f2fc00f7 100755
--- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
+++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
@@ -25,8 +25,10 @@ logger = ft_logger.Logger("refstack_defcore").getLogger()
class RefstackClient(testcase.TestCase):
- def __init__(self, case_name="refstack_defcore"):
- super(RefstackClient, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "refstack_defcore"
+ super(RefstackClient, self).__init__(**kwargs)
self.FUNCTEST_TEST = CONST.dir_functest_test
self.CONF_PATH = CONST.refstack_tempest_conf_path
self.DEFCORE_LIST = CONST.refstack_defcore_list
@@ -131,10 +133,10 @@ class RefstackClient(testcase.TestCase):
except Exception:
success_rate = 0
- self.criteria = ft_utils.check_success_rate(
+ self.result = ft_utils.check_success_rate(
self.case_name, success_rate)
logger.info("Testcase %s success_rate is %s%%, is marked as %s"
- % (self.case_name, success_rate, self.criteria))
+ % (self.case_name, success_rate, self.result))
def run(self):
'''used for functest command line,
@@ -169,7 +171,7 @@ class RefstackClient(testcase.TestCase):
'''used for manually running,
python refstack_client.py -c <tempest_conf_path>
--testlist <testlist_path>
- can generate a reference tempest.conf by
+ can generate a reference refstack_tempest.conf by
python tempest_conf.py
'''
try:
@@ -204,7 +206,7 @@ class RefstackClientParser(object):
self.parser = argparse.ArgumentParser()
self.parser.add_argument(
'-c', '--config',
- help='the file path of tempest.conf',
+ help='the file path of refstack_tempest.conf',
default=self.confpath)
self.parser.add_argument(
'-t', '--testlist',
diff --git a/functest/opnfv_tests/openstack/snaps/api_check.py b/functest/opnfv_tests/openstack/snaps/api_check.py
index dea1ca759..50f67094b 100644
--- a/functest/opnfv_tests/openstack/snaps/api_check.py
+++ b/functest/opnfv_tests/openstack/snaps/api_check.py
@@ -11,7 +11,6 @@ from snaps import test_suite_builder
from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \
SnapsTestRunner
-from functest.utils.constants import CONST
class ApiCheck(SnapsTestRunner):
@@ -20,13 +19,15 @@ class ApiCheck(SnapsTestRunner):
that exercise many of the OpenStack APIs within Keystone, Glance, Neutron,
and Nova
"""
- def __init__(self, case_name="api_check"):
- super(ApiCheck, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "api_check"
+ super(ApiCheck, self).__init__(**kwargs)
self.suite = unittest.TestSuite()
test_suite_builder.add_openstack_api_tests(
- self.suite,
- CONST.openstack_creds,
- self.ext_net_name,
- use_keystone=CONST.snaps_use_keystone)
+ suite=self.suite,
+ os_creds=self.os_creds,
+ ext_net_name=self.ext_net_name,
+ use_keystone=self.use_keystone)
diff --git a/functest/opnfv_tests/openstack/snaps/connection_check.py b/functest/opnfv_tests/openstack/snaps/connection_check.py
index 57b74d4c2..f2753aea4 100644
--- a/functest/opnfv_tests/openstack/snaps/connection_check.py
+++ b/functest/opnfv_tests/openstack/snaps/connection_check.py
@@ -11,7 +11,6 @@ from snaps import test_suite_builder
from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \
SnapsTestRunner
-from functest.utils.constants import CONST
class ConnectionCheck(SnapsTestRunner):
@@ -20,13 +19,15 @@ class ConnectionCheck(SnapsTestRunner):
that simply obtain the different OpenStack clients and may perform
simple queries
"""
- def __init__(self, case_name="connection_check"):
- super(ConnectionCheck, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "connection_check"
+ super(ConnectionCheck, self).__init__(**kwargs)
self.suite = unittest.TestSuite()
test_suite_builder.add_openstack_client_tests(
- self.suite,
- CONST.openstack_creds,
- self.ext_net_name,
- use_keystone=CONST.snaps_use_keystone)
+ suite=self.suite,
+ os_creds=self.os_creds,
+ ext_net_name=self.ext_net_name,
+ use_keystone=self.use_keystone)
diff --git a/functest/opnfv_tests/openstack/snaps/health_check.py b/functest/opnfv_tests/openstack/snaps/health_check.py
index 6b3cfdd0d..c057eb2b0 100644
--- a/functest/opnfv_tests/openstack/snaps/health_check.py
+++ b/functest/opnfv_tests/openstack/snaps/health_check.py
@@ -21,18 +21,20 @@ class HealthCheck(SnapsTestRunner):
creates a VM with a single port with an IPv4 address that is assigned by
DHCP. This test then validates the expected IP with the actual
"""
- def __init__(self, case_name="snaps_health_check"):
- super(HealthCheck, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "snaps_health_check"
+ super(HealthCheck, self).__init__(**kwargs)
self.suite = unittest.TestSuite()
image_custom_config = None
if hasattr(CONST, 'snaps_health_check'):
- image_custom_config = CONST.snaps_health_check
-
+ image_custom_config = CONST.__getattribute__('snaps_health_check')
self.suite.addTest(
OSIntegrationTestCase.parameterize(
- SimpleHealthCheck, CONST.openstack_creds, self.ext_net_name,
- use_keystone=CONST.snaps_use_keystone,
+ SimpleHealthCheck, os_creds=self.os_creds,
+ ext_net_name=self.ext_net_name,
+ use_keystone=self.use_keystone,
flavor_metadata=self.flavor_metadata,
image_metadata=image_custom_config))
diff --git a/functest/opnfv_tests/openstack/snaps/smoke.py b/functest/opnfv_tests/openstack/snaps/smoke.py
index 45fa6de86..2c6fc2553 100644
--- a/functest/opnfv_tests/openstack/snaps/smoke.py
+++ b/functest/opnfv_tests/openstack/snaps/smoke.py
@@ -21,30 +21,31 @@ class SnapsSmoke(SnapsTestRunner):
that exercise many of the OpenStack APIs within Keystone, Glance, Neutron,
and Nova
"""
- def __init__(self):
- super(SnapsSmoke, self).__init__()
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "snaps_smoke"
+ super(SnapsSmoke, self).__init__(**kwargs)
self.suite = unittest.TestSuite()
- self.case_name = "snaps_smoke"
- use_fip = CONST.snaps_use_floating_ips
# The snaps smoke test uses the same config as the
# snaps_health_check suite, so reuse it here
image_custom_config = None
if hasattr(CONST, 'snaps_health_check'):
- image_custom_config = CONST.snaps_health_check
+ image_custom_config = CONST.__getattribute__('snaps_health_check')
# Tests requiring floating IPs leverage files contained within the
# SNAPS repository and are found relative to that path
- if use_fip:
- snaps_dir = CONST.dir_repo_snaps + '/snaps'
+ if self.use_fip:
+ snaps_dir = os.path.join(CONST.__getattribute__('dir_repo_snaps'),
+ 'snaps')
os.chdir(snaps_dir)
test_suite_builder.add_openstack_integration_tests(
- self.suite,
- CONST.openstack_creds,
- self.ext_net_name,
- use_keystone=CONST.snaps_use_keystone,
+ suite=self.suite,
+ os_creds=self.os_creds,
+ ext_net_name=self.ext_net_name,
+ use_keystone=self.use_keystone,
flavor_metadata=self.flavor_metadata,
image_metadata=image_custom_config,
- use_floating_ips=use_fip)
+ use_floating_ips=self.use_fip)
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
index 044a0bb04..8a68cad9e 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
@@ -5,12 +5,13 @@
#
# 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
+from functest.utils.constants import CONST
from snaps.openstack import create_flavor
+from snaps.openstack.tests import openstack_tests
class SnapsTestRunner(PyTestSuiteRunner):
@@ -19,15 +20,20 @@ class SnapsTestRunner(PyTestSuiteRunner):
creates a VM with a single port with an IPv4 address that is assigned by
DHCP. This test then validates the expected IP with the actual
"""
- def __init__(self, case_name=''):
- super(SnapsTestRunner, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ super(SnapsTestRunner, self).__init__(**kwargs)
- self.ext_net_name = snaps_utils.get_ext_net_name()
- self.logger = ft_logger.Logger(self.project_name).getLogger()
+ self.os_creds = openstack_tests.get_credentials(
+ os_env_file=CONST.__getattribute__('openstack_creds'),
+ proxy_settings_str=None, ssh_proxy_cmd=None)
+
+ self.ext_net_name = snaps_utils.get_ext_net_name(self.os_creds)
+ self.use_fip = CONST.__getattribute__('snaps_use_floating_ips')
+ self.use_keystone = CONST.__getattribute__('snaps_use_keystone')
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)
+ self.logger.info("Using flavor metadata '%s'", self.flavor_metadata)
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_utils.py b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
index 4ea1a04ad..327ba073d 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_utils.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
@@ -5,19 +5,15 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
-from snaps.openstack.tests import openstack_tests
from snaps.openstack.utils import neutron_utils
-from functest.utils.constants import CONST
-
-def get_ext_net_name():
+def get_ext_net_name(os_creds):
"""
Returns the first external network name
+ :param: os_creds: an instance of snaps OSCreds object
:return:
"""
- os_env_file = CONST.openstack_creds
- os_creds = openstack_tests.get_credentials(os_env_file=os_env_file)
neutron = neutron_utils.neutron_client(os_creds)
ext_nets = neutron_utils.get_external_networks(neutron)
return ext_nets[0]['network']['name']
diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt
index 0da92cd8a..026b24f41 100644
--- a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt
+++ b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt
@@ -52,7 +52,7 @@
tests:
- tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops
-
+-
# https://bugs.opendaylight.org/show_bug.cgi?id=5586
scenarios:
- os-odl-bgpvpn-ha
@@ -60,6 +60,5 @@
- os-odl_l2-bgpvpn-ha
installers:
- apex
- - fuel
tests:
- tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_reboot_server_hard
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index c3184e352..e6c6b44f7 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -28,8 +28,8 @@ logger = ft_logger.Logger("Tempest").getLogger()
class TempestCommon(testcase.TestCase):
- def __init__(self, case_name=''):
- super(TempestCommon, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ super(TempestCommon, self).__init__(**kwargs)
self.MODE = ""
self.OPTION = ""
self.VERIFIER_ID = conf_utils.get_verifier_id()
@@ -200,19 +200,17 @@ class TempestCommon(testcase.TestCase):
except Exception:
success_rate = 0
- self.criteria = ft_utils.check_success_rate(
+ self.result = ft_utils.check_success_rate(
self.case_name, success_rate)
logger.info("Tempest %s success_rate is %s%%, is marked as %s"
- % (self.case_name, success_rate, self.criteria))
+ % (self.case_name, success_rate, self.result))
def run(self):
self.start_time = time.time()
-
- if not os.path.exists(conf_utils.TEMPEST_RESULTS_DIR):
- os.makedirs(conf_utils.TEMPEST_RESULTS_DIR)
-
try:
+ if not os.path.exists(conf_utils.TEMPEST_RESULTS_DIR):
+ os.makedirs(conf_utils.TEMPEST_RESULTS_DIR)
image_and_flavor = conf_utils.create_tempest_resources()
conf_utils.configure_tempest(
self.DEPLOYMENT_DIR,
@@ -234,31 +232,39 @@ class TempestCommon(testcase.TestCase):
class TempestSmokeSerial(TempestCommon):
- def __init__(self, case_name='tempest_smoke_serial'):
- TempestCommon.__init__(self, case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'tempest_smoke_serial'
+ TempestCommon.__init__(self, **kwargs)
self.MODE = "smoke"
self.OPTION = "--concurrency 1"
class TempestSmokeParallel(TempestCommon):
- def __init__(self, case_name='tempest_smoke_parallel'):
- TempestCommon.__init__(self, case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'tempest_smoke_parallel'
+ TempestCommon.__init__(self, **kwargs)
self.MODE = "smoke"
self.OPTION = ""
class TempestFullParallel(TempestCommon):
- def __init__(self, case_name="tempest_full_parallel"):
- TempestCommon.__init__(self, case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'tempest_full_parallel'
+ TempestCommon.__init__(self, **kwargs)
self.MODE = "full"
class TempestMultisite(TempestCommon):
- def __init__(self, case_name="multisite"):
- TempestCommon.__init__(self, case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'multisite'
+ TempestCommon.__init__(self, **kwargs)
self.MODE = "feature_multisite"
self.OPTION = "--concurrency 1"
conf_utils.install_verifier_ext(CONST.dir_repo_kingbird)
@@ -266,15 +272,19 @@ class TempestMultisite(TempestCommon):
class TempestCustom(TempestCommon):
- def __init__(self, case_name="tempest_custom"):
- TempestCommon.__init__(self, case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'tempest_custom'
+ TempestCommon.__init__(self, **kwargs)
self.MODE = "custom"
self.OPTION = "--concurrency 1"
class TempestDefcore(TempestCommon):
- def __init__(self, case_name="tempest_defcore"):
- TempestCommon.__init__(self, case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'tempest_defcore'
+ TempestCommon.__init__(self, **kwargs)
self.MODE = "defcore"
self.OPTION = "--concurrency 1"
diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py
index 64cb0004d..8bf263eb2 100644
--- a/functest/opnfv_tests/openstack/vping/vping_base.py
+++ b/functest/opnfv_tests/openstack/vping/vping_base.py
@@ -18,8 +18,8 @@ from functest.utils.constants import CONST
class VPingBase(testcase.TestCase):
- def __init__(self, case_name=''):
- super(VPingBase, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ super(VPingBase, self).__init__(**kwargs)
self.logger = None
self.functest_repo = CONST.dir_repo_functest
self.repo = CONST.dir_vping
@@ -273,7 +273,7 @@ class VPingBase(testcase.TestCase):
self.details = {'timestart': start_time,
'duration': duration,
'status': test_status}
- self.criteria = test_status
+ self.result = test_status
@staticmethod
def pMsg(msg):
diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py
index a68b0ff75..c26c4e0c0 100755
--- a/functest/opnfv_tests/openstack/vping/vping_ssh.py
+++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py
@@ -24,8 +24,10 @@ import functest.core.testcase as testcase
class VPingSSH(vping_base.VPingBase):
- def __init__(self, case_name='vping_ssh'):
- super(VPingSSH, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "vping_ssh"
+ super(VPingSSH, self).__init__(**kwargs)
self.logger = ft_logger.Logger(self.case_name).getLogger()
def do_vping(self, vm, test_ip):
diff --git a/functest/opnfv_tests/openstack/vping/vping_userdata.py b/functest/opnfv_tests/openstack/vping/vping_userdata.py
index e9b869983..1b00ca23a 100755
--- a/functest/opnfv_tests/openstack/vping/vping_userdata.py
+++ b/functest/opnfv_tests/openstack/vping/vping_userdata.py
@@ -18,8 +18,10 @@ import vping_base
class VPingUserdata(vping_base.VPingBase):
- def __init__(self, case_name='vping_userdata'):
- super(VPingUserdata, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "vping_userdata"
+ super(VPingUserdata, self).__init__(**kwargs)
self.logger = ft_logger.Logger(self.case_name).getLogger()
def boot_vm_preparation(self, config, vmname, test_ip):
diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py
index c0e2a9aeb..6f4acf6dd 100755
--- a/functest/opnfv_tests/sdn/odl/odl.py
+++ b/functest/opnfv_tests/sdn/odl/odl.py
@@ -100,7 +100,7 @@ class ODLTests(testcase.TestCase):
result = robot.api.ExecutionResult(xml_file)
visitor = ODLResultVisitor()
result.visit(visitor)
- self.criteria = result.suite.status
+ self.result = result.suite.status
self.start_time = timestamp_to_secs(result.suite.starttime)
self.stop_time = timestamp_to_secs(result.suite.endtime)
self.details = {}
@@ -112,6 +112,7 @@ class ODLTests(testcase.TestCase):
It has been designed to be called in any context.
It requires the following keyword arguments:
+
* odlusername,
* odlpassword,
* osauthurl,
@@ -130,7 +131,7 @@ class ODLTests(testcase.TestCase):
* delete temporary files.
Args:
- **kwargs: Arbitrary keyword arguments.
+ kwargs: Arbitrary keyword arguments.
Returns:
EX_OK if all suites ran well.
@@ -197,7 +198,7 @@ class ODLTests(testcase.TestCase):
required.
Args:
- **kwargs: Arbitrary keyword arguments.
+ kwargs: Arbitrary keyword arguments.
Returns:
EX_OK if all suites ran well.
diff --git a/functest/opnfv_tests/sdn/onos/onos.py b/functest/opnfv_tests/sdn/onos/onos.py
index fe37669a4..4d489d674 100644
--- a/functest/opnfv_tests/sdn/onos/onos.py
+++ b/functest/opnfv_tests/sdn/onos/onos.py
@@ -21,16 +21,21 @@ import functest.utils.functest_utils as ft_utils
import functest.utils.openstack_utils as openstack_utils
-logger = ft_logger.Logger(__name__).getLogger()
-
-
class OnosBase(testcase.TestCase):
- onos_repo_path = CONST.dir_repo_onos
- onos_sfc_image_name = CONST.onos_sfc_image_name
- onos_sfc_image_path = os.path.join(CONST.dir_functest_data,
- CONST.onos_sfc_image_file_name)
- onos_sfc_path = os.path.join(CONST.dir_repo_functest,
- CONST.dir_onos_sfc)
+ onos_repo_path = CONST.__getattribute__('dir_repo_onos')
+ onos_sfc_image_name = CONST.__getattribute__('onos_sfc_image_name')
+ onos_sfc_image_path = os.path.join(
+ CONST.__getattribute__('dir_functest_data'),
+ CONST.__getattribute__('onos_sfc_image_file_name'))
+ onos_sfc_path = os.path.join(CONST.__getattribute__('dir_repo_functest'),
+ CONST.__getattribute__('dir_onos_sfc'))
+ installer_type = CONST.__getattribute__('INSTALLER_TYPE')
+ logger = ft_logger.Logger(__name__).getLogger()
+
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "onos_base"
+ super(OnosBase, self).__init__(**kwargs)
def run(self):
self.start_time = time.time()
@@ -38,7 +43,7 @@ class OnosBase(testcase.TestCase):
self._run()
res = testcase.TestCase.EX_OK
except Exception as e:
- logger.error('Error with run: %s', e)
+ self.logger.error('Error with run: %s', e)
res = testcase.TestCase.EX_RUN_ERROR
self.stop_time = time.time()
@@ -49,25 +54,27 @@ class OnosBase(testcase.TestCase):
class Onos(OnosBase):
- def __init__(self, case_name='onos'):
- super(Onos, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "onos"
+ super(Onos, self).__init__(**kwargs)
self.log_path = os.path.join(self.onos_repo_path, 'TestON/logs')
def set_onos_ip(self):
- if (CONST.INSTALLER_TYPE and
- CONST.INSTALLER_TYPE.lower() == 'joid'):
+ if (self.installer_type and
+ self.installer_type.lower() == 'joid'):
sdn_controller_env = os.getenv('SDN_CONTROLLER')
OC1 = re.search(r"\d+\.\d+\.\d+\.\d+", sdn_controller_env).group()
else:
neutron_url = openstack_utils.get_endpoint(service_type='network')
OC1 = urlparse.urlparse(neutron_url).hostname
os.environ['OC1'] = OC1
- logger.debug("ONOS IP is %s" % OC1)
+ self.logger.debug("ONOS IP is %s", OC1)
def run_onos_script(self, testname):
cli_dir = os.path.join(self.onos_repo_path, 'TestON/bin/cli.py')
cmd = '{0} run {1}'.format(cli_dir, testname)
- logger.debug("Run script: %s" % testname)
+ self.logger.debug("Run script: %s", testname)
ft_utils.execute_command_raise(
cmd,
error_msg=('Error when running ONOS script: %s'
@@ -82,8 +89,8 @@ class Onos(OnosBase):
elif os.path.isfile(log):
os.remove(log)
except OSError as e:
- logger.error('Error with deleting file %s: %s',
- log, e.strerror)
+ self.logger.error('Error with deleting file %s: %s',
+ log, e.strerror)
def get_result(self):
cmd = 'grep -rnh Fail {0}'.format(self.log_path)
@@ -93,9 +100,9 @@ class Onos(OnosBase):
stderr=subprocess.STDOUT)
for line in p.stdout:
- logger.debug(line)
+ self.logger.debug(line)
if re.search("\s+[1-9]+\s+", line):
- logger.debug("Testcase Fails\n" + line)
+ self.logger.debug("Testcase Fails\n" + line)
cmd = "grep -rnh 'Execution Time' {0}".format(self.log_path)
result_buffer = os.popen(cmd).read()
@@ -153,10 +160,10 @@ class Onos(OnosBase):
if (result['FUNCvirNet']['result'] == "Success" and
result['FUNCvirNetL3']['result'] == "Success"):
status = "PASS"
- except:
- logger.error("Unable to set ONOS criteria")
+ except Exception:
+ self.logger.error("Unable to set ONOS result")
- self.criteria = status
+ self.result = status
self.details = result
def _run(self):
@@ -168,13 +175,14 @@ class Onos(OnosBase):
class OnosSfc(OnosBase):
- def __init__(self):
- super(OnosSfc, self).__init__()
- self.case_name = 'onos_sfc'
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "onos_sfc"
+ super(OnosSfc, self).__init__(**kwargs)
- def get_ip(type):
+ def get_ip(self, type):
url = openstack_utils.get_endpoint(service_type=type)
- logger.debug('get_ip for %s: %s' % (type, url))
+ self.logger.debug('get_ip for %s: %s', type, url)
return urlparse.urlparse(url).hostname
def update_sfc_onos_file(self, before, after):
@@ -188,6 +196,7 @@ class OnosSfc(OnosBase):
% (before, after)))
def create_image(self):
+ self.logger.warn('inside create_image')
glance_client = openstack_utils.get_glance_client()
image_id = openstack_utils.create_glance_image(
glance_client,
@@ -196,19 +205,20 @@ class OnosSfc(OnosBase):
if image_id is None:
raise Exception('Failed to create image')
- logger.debug("Image '%s' with ID=%s is created successfully."
- % (self.onos_sfc_image_name, image_id))
+ self.logger.debug("Image '%s' with ID=%s is created successfully.",
+ self.onos_sfc_image_name, image_id)
def set_sfc_conf(self):
self.update_sfc_onos_file("keystone_ip", self.get_ip("keystone"))
self.update_sfc_onos_file("neutron_ip", self.get_ip("neutron"))
self.update_sfc_onos_file("nova_ip", self.get_ip("nova"))
self.update_sfc_onos_file("glance_ip", self.get_ip("glance"))
- self.update_sfc_onos_file("console", CONST.OS_PASSWORD)
+ self.update_sfc_onos_file("console",
+ CONST.__getattribute__('OS_PASSWORD'))
neutron_client = openstack_utils.get_neutron_client()
ext_net = openstack_utils.get_external_net(neutron_client)
self.update_sfc_onos_file("admin_floating_net", ext_net)
- logger.debug("SFC configuration is modified")
+ self.logger.debug("SFC configuration is modified")
def sfc_test(self):
cmd = 'python {0}'.format(os.path.join(self.onos_sfc_path, 'sfc.py'))
diff --git a/functest/opnfv_tests/vnf/aaa/aaa.py b/functest/opnfv_tests/vnf/aaa/aaa.py
index f80e7bcc0..9c94cfb1a 100755
--- a/functest/opnfv_tests/vnf/aaa/aaa.py
+++ b/functest/opnfv_tests/vnf/aaa/aaa.py
@@ -20,8 +20,10 @@ class AaaVnf(vnf_base.VnfOnBoardingBase):
logger = ft_logger.Logger("VNF AAA").getLogger()
- def __init__(self):
- super(AaaVnf, self).__init__(case_name="aaa")
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "aaa"
+ super(AaaVnf, self).__init__(**kwargs)
def deploy_orchestrator(self):
self.logger.info("No VNFM needed to deploy a free radius here")
@@ -47,7 +49,7 @@ class AaaVnf(vnf_base.VnfOnBoardingBase):
def main(self, **kwargs):
self.logger.info("AAA VNF onboarding")
self.execute()
- if self.criteria is "PASS":
+ if self.result is "PASS":
return self.EX_OK
else:
return self.EX_RUN_ERROR
diff --git a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
index 2fc5449cf..494633f4f 100644
--- a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
+++ b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
@@ -20,13 +20,12 @@ import functest.utils.functest_utils as ft_utils
class ClearwaterOnBoardingBase(vnf_base.VnfOnBoardingBase):
- def __init__(self, project='functest', case='', repo='', cmd=''):
+ def __init__(self, **kwargs):
self.logger = ft_logger.Logger(__name__).getLogger()
- super(ClearwaterOnBoardingBase, self).__init__(
- project, case, repo, cmd)
+ super(ClearwaterOnBoardingBase, self).__init__(**kwargs)
self.case_dir = os.path.join(CONST.dir_functest_test, 'vnf', 'ims')
self.data_dir = CONST.dir_ims_data
- self.result_dir = os.path.join(CONST.dir_results, case)
+ self.result_dir = os.path.join(CONST.dir_results, self.case_name)
self.test_dir = CONST.dir_repo_vims_test
if not os.path.exists(self.data_dir):
diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
index d739335dc..0e6d47970 100644
--- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py
+++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
@@ -25,9 +25,10 @@ import functest.utils.openstack_utils as os_utils
class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
- def __init__(self, project='functest', case_name='cloudify_ims',
- repo='', cmd=''):
- super(CloudifyIms, self).__init__(project, case_name, repo, cmd)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "cloudify_ims"
+ super(CloudifyIms, self).__init__(**kwargs)
self.logger = ft_logger.Logger(__name__).getLogger()
# Retrieve the configuration
@@ -276,7 +277,7 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
self.logger.info("Cloudify IMS VNF onboarding test starting")
self.execute()
self.logger.info("Cloudify IMS VNF onboarding test executed")
- if self.criteria is "PASS":
+ if self.result is "PASS":
return self.EX_OK
else:
return self.EX_RUN_ERROR
diff --git a/functest/opnfv_tests/vnf/ims/opera_ims.py b/functest/opnfv_tests/vnf/ims/opera_ims.py
index 7ca96ae12..a46f9d71f 100644
--- a/functest/opnfv_tests/vnf/ims/opera_ims.py
+++ b/functest/opnfv_tests/vnf/ims/opera_ims.py
@@ -119,7 +119,7 @@ class OperaIms(clearwater_ims_base.ClearwaterOnBoardingBase):
self.logger.info("Start to run Opera vIMS VNF onboarding test")
self.execute()
self.logger.info("Opera vIMS VNF onboarding test finished")
- if self.criteria is "PASS":
+ if self.result is "PASS":
return self.EX_OK
else:
return self.EX_RUN_ERROR
diff --git a/functest/opnfv_tests/vnf/ims/orchestra_ims.py b/functest/opnfv_tests/vnf/ims/orchestra_ims.py
index c95a17e28..351c5fbe2 100755
--- a/functest/opnfv_tests/vnf/ims/orchestra_ims.py
+++ b/functest/opnfv_tests/vnf/ims/orchestra_ims.py
@@ -484,7 +484,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
self.logger.info("Orchestra IMS VNF onboarding test starting")
self.execute()
self.logger.info("Orchestra IMS VNF onboarding test executed")
- if self.criteria is "PASS":
+ if self.result is "PASS":
return self.EX_OK
else:
return self.EX_RUN_ERROR
diff --git a/functest/opnfv_tests/vnf/rnc/parser.py b/functest/opnfv_tests/vnf/rnc/parser.py
deleted file mode 100644
index 133145d74..000000000
--- a/functest/opnfv_tests/vnf/rnc/parser.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2016 ZTE Corporation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-import functest.core.feature as base
-
-
-class Parser(base.Feature):
- def __init__(self):
- super(Parser, self).__init__(project='parser',
- case='parser-basics',
- repo='dir_repo_parser')
- self.cmd = 'cd %s/tests && ./functest_run.sh' % self.repo
diff --git a/functest/opnfv_tests/vnf/router/vyos_vrouter.py b/functest/opnfv_tests/vnf/router/vyos_vrouter.py
index e188c3fbb..5654278db 100644
--- a/functest/opnfv_tests/vnf/router/vyos_vrouter.py
+++ b/functest/opnfv_tests/vnf/router/vyos_vrouter.py
@@ -14,10 +14,11 @@ RESULT_DETAILS_FILE = "test_result.json"
class VrouterVnf(base.Feature):
- def __init__(self):
- super(VrouterVnf, self).__init__(project='functest',
- case='vyos_vrouter',
- repo='dir_repo_vrouter')
+ def __init__(self, **kwargs):
+ kwargs["repo"] = 'dir_repo_vrouter'
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "vyos_vrouter"
+ super(VrouterVnf, self).__init__(**kwargs)
self.cmd = 'cd %s && ./run.sh' % self.repo
def set_result_details(self):
@@ -28,6 +29,6 @@ class VrouterVnf(base.Feature):
f.close()
def log_results(self):
- if self.criteria == 'PASS':
+ if self.result == 'PASS':
self.set_result_details()
super(VrouterVnf, self).log_results()
diff --git a/functest/tests/unit/ci/test_tier_builder.py b/functest/tests/unit/ci/test_tier_builder.py
index 48c94a57d..438fa7c25 100644
--- a/functest/tests/unit/ci/test_tier_builder.py
+++ b/functest/tests/unit/ci/test_tier_builder.py
@@ -22,7 +22,7 @@ class TierBuilderTesting(unittest.TestCase):
'scenario': 'test_scenario'}
self.testcase = {'dependencies': self.dependency,
- 'name': 'test_name',
+ 'case_name': 'test_name',
'criteria': 'test_criteria',
'blocking': 'test_blocking',
'clean_flag': 'test_clean_flag',
diff --git a/functest/tests/unit/core/test_feature.py b/functest/tests/unit/core/test_feature.py
index 0ed178a1d..993da5a03 100644
--- a/functest/tests/unit/core/test_feature.py
+++ b/functest/tests/unit/core/test_feature.py
@@ -16,92 +16,82 @@ import mock
from functest.core import feature
from functest.core import testcase
-from functest.utils import constants
+# logging must be disabled else it calls time.time()
+# what will break these unit tests.
+logging.disable(logging.CRITICAL)
-class FeatureInitTesting(unittest.TestCase):
- logging.disable(logging.CRITICAL)
+class FeatureTestingBase(unittest.TestCase):
- @unittest.skip("JIRA: FUNCTEST-780")
- def test_init_with_wrong_repo(self):
- with self.assertRaises(ValueError):
- feature.Feature(repo='foo')
+ _case_name = "foo"
+ _project_name = "bar"
+ _repo = "dir_repo_copper"
+ _cmd = "cd /home/opnfv/repos/foo/tests && bash run.sh && cd -"
+ _output_file = '/home/opnfv/functest/results/bar.log'
+ feature = None
- def test_init(self):
- barometer = feature.Feature(repo='dir_repo_barometer')
- self.assertEqual(barometer.project_name, "functest")
- self.assertEqual(barometer.case_name, "")
- self.assertEqual(
- barometer.repo,
- constants.CONST.__getattribute__('dir_repo_barometer'))
+ @mock.patch('time.time', side_effect=[1, 2])
+ def _test_run(self, status, mock_method=None):
+ self.assertEqual(self.feature.run(cmd=self._cmd), status)
+ if status == testcase.TestCase.EX_OK:
+ self.assertEqual(self.feature.result, 100)
+ else:
+ self.assertEqual(self.feature.result, 0)
+ mock_method.assert_has_calls([mock.call(), mock.call()])
+ self.assertEqual(self.feature.start_time, 1)
+ self.assertEqual(self.feature.stop_time, 2)
-class FeatureTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
+class FeatureTesting(FeatureTestingBase):
def setUp(self):
- self.feature = feature.Feature(repo='dir_repo_barometer')
+ self.feature = feature.Feature(
+ project_name=self._project_name, case_name=self._case_name)
- @unittest.skip("JIRA: FUNCTEST-781")
- def test_prepare_ko(self):
- # pylint: disable=bad-continuation
- with mock.patch.object(
- self.feature, 'prepare',
- return_value=testcase.TestCase.EX_RUN_ERROR) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-781")
- def test_prepare_exc(self):
- with mock.patch.object(self.feature, 'prepare',
- side_effect=Exception) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-781")
- def test_post_ko(self):
+ def test_run_exc(self):
# pylint: disable=bad-continuation
with mock.patch.object(
- self.feature, 'post',
- return_value=testcase.TestCase.EX_RUN_ERROR) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-781")
- def test_post_exc(self):
- with mock.patch.object(self.feature, 'post',
- side_effect=Exception) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-778")
- def test_execute_ko(self):
- with mock.patch.object(self.feature, 'execute',
- return_value=1) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-778")
- def test_execute_exc(self):
- with mock.patch.object(self.feature, 'execute',
- side_effect=Exception) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
+ self.feature, 'execute',
+ side_effect=Exception) as mock_method:
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+ mock_method.assert_called_once_with(cmd=self._cmd)
def test_run(self):
- with mock.patch.object(self.feature, 'execute',
- return_value=0) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_OK)
- mock_object.assert_called_once_with()
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+
+
+class BashFeatureTesting(FeatureTestingBase):
+
+ def setUp(self):
+ self.feature = feature.BashFeature(
+ project_name=self._project_name, case_name=self._case_name)
+
+ @mock.patch("functest.utils.functest_utils.execute_command")
+ def test_run_no_cmd(self, mock_method=None):
+ self.assertEqual(self.feature.run(), testcase.TestCase.EX_RUN_ERROR)
+ mock_method.assert_not_called()
+
+ @mock.patch("functest.utils.functest_utils.execute_command",
+ return_value=1)
+ def test_run_ko(self, mock_method=None):
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+ mock_method.assert_called_once_with(
+ self._cmd, output_file=self._output_file)
+
+ @mock.patch("functest.utils.functest_utils.execute_command",
+ side_effect=Exception)
+ def test_run_exc(self, mock_method=None):
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+ mock_method.assert_called_once_with(
+ self._cmd, output_file=self._output_file)
+
+ @mock.patch("functest.utils.functest_utils.execute_command",
+ return_value=0)
+ def test_run(self, mock_method):
+ self._test_run(testcase.TestCase.EX_OK)
+ mock_method.assert_called_once_with(
+ self._cmd, output_file=self._output_file)
if __name__ == "__main__":
diff --git a/functest/tests/unit/core/test_testcase.py b/functest/tests/unit/core/test_testcase.py
index 5ff41cd65..cc8446d80 100644
--- a/functest/tests/unit/core/test_testcase.py
+++ b/functest/tests/unit/core/test_testcase.py
@@ -27,13 +27,15 @@ class TestCaseTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
_case_name = "base"
+ _project_name = "functest"
+ _published_result = "PASS"
def setUp(self):
- self.test = testcase.TestCase(case_name=self._case_name)
- self.test.project = "functest"
+ self.test = testcase.TestCase(case_name=self._case_name,
+ project_name=self._project_name)
self.test.start_time = "1"
self.test.stop_time = "2"
- self.test.criteria = "PASS"
+ self.test.result = 100
self.test.details = {"Hello": "World"}
def test_run_unimplemented(self):
@@ -55,10 +57,6 @@ class TestCaseTesting(unittest.TestCase):
self.test.case_name = None
self._test_missing_attribute()
- def test_missing_criteria(self):
- self.test.criteria = None
- self._test_missing_attribute()
-
def test_missing_start_time(self):
self.test.start_time = None
self._test_missing_attribute()
@@ -74,8 +72,8 @@ class TestCaseTesting(unittest.TestCase):
self.assertEqual(self.test.push_to_db(),
testcase.TestCase.EX_OK)
mock_function.assert_called_once_with(
- self.test.project, self._case_name, self.test.start_time,
- self.test.stop_time, self.test.criteria, self.test.details)
+ self._project_name, self._case_name, self.test.start_time,
+ self.test.stop_time, self._published_result, self.test.details)
@mock.patch('functest.utils.functest_utils.push_results_to_db',
return_value=False)
@@ -83,8 +81,8 @@ class TestCaseTesting(unittest.TestCase):
self.assertEqual(self.test.push_to_db(),
testcase.TestCase.EX_PUSH_TO_DB_ERROR)
mock_function.assert_called_once_with(
- self.test.project, self._case_name, self.test.start_time,
- self.test.stop_time, self.test.criteria, self.test.details)
+ self._project_name, self._case_name, self.test.start_time,
+ self.test.stop_time, self._published_result, self.test.details)
@mock.patch('functest.utils.functest_utils.push_results_to_db',
return_value=True)
@@ -92,24 +90,78 @@ class TestCaseTesting(unittest.TestCase):
self.assertEqual(self.test.push_to_db(),
testcase.TestCase.EX_OK)
mock_function.assert_called_once_with(
- self.test.project, self._case_name, self.test.start_time,
- self.test.stop_time, self.test.criteria, self.test.details)
+ self._project_name, self._case_name, self.test.start_time,
+ self.test.stop_time, self._published_result, self.test.details)
+
+ @mock.patch('functest.utils.functest_utils.push_results_to_db',
+ return_value=True)
+ def test_push_to_db_res_ko(self, mock_function=None):
+ self.test.result = 0
+ self.assertEqual(self.test.push_to_db(),
+ testcase.TestCase.EX_OK)
+ mock_function.assert_called_once_with(
+ self._project_name, self._case_name, self.test.start_time,
+ self.test.stop_time, 'FAIL', self.test.details)
+
+ @mock.patch('functest.utils.functest_utils.push_results_to_db',
+ return_value=True)
+ def test_push_to_db_both_ko(self, mock_function=None):
+ self.test.result = 0
+ self.test.criteria = 0
+ self.assertEqual(self.test.push_to_db(),
+ testcase.TestCase.EX_OK)
+ mock_function.assert_called_once_with(
+ self._project_name, self._case_name, self.test.start_time,
+ self.test.stop_time, 'FAIL', self.test.details)
def test_check_criteria_missing(self):
self.test.criteria = None
- self.assertEqual(self.test.check_criteria(),
+ self.assertEqual(self.test.check_result(),
+ testcase.TestCase.EX_TESTCASE_FAILED)
+
+ def test_check_result_missing(self):
+ self.test.result = None
+ self.assertEqual(self.test.check_result(),
+ testcase.TestCase.EX_TESTCASE_FAILED)
+
+ def test_check_result_failed(self):
+ # Backward compatibility
+ # It must be removed as soon as TestCase subclasses
+ # stop setting result = 'PASS' or 'FAIL'.
+ self.test.result = 'FAIL'
+ self.assertEqual(self.test.check_result(),
testcase.TestCase.EX_TESTCASE_FAILED)
- def test_check_criteria_failed(self):
- self.test.criteria = 'FAILED'
- self.assertEqual(self.test.check_criteria(),
+ def test_check_result_pass(self):
+ # Backward compatibility
+ # It must be removed as soon as TestCase subclasses
+ # stop setting result = 'PASS' or 'FAIL'.
+ self.test.result = 'PASS'
+ self.assertEqual(self.test.check_result(),
+ testcase.TestCase.EX_OK)
+
+ def test_check_result_lt(self):
+ self.test.result = 50
+ self.assertEqual(self.test.check_result(),
testcase.TestCase.EX_TESTCASE_FAILED)
- def test_check_criteria_pass(self):
- self.test.criteria = 'PASS'
- self.assertEqual(self.test.check_criteria(),
+ def test_check_result_eq(self):
+ self.test.result = 100
+ self.assertEqual(self.test.check_result(),
+ testcase.TestCase.EX_OK)
+
+ def test_check_result_gt(self):
+ self.test.criteria = 50
+ self.test.result = 100
+ self.assertEqual(self.test.check_result(),
testcase.TestCase.EX_OK)
+ def test_check_result_zero(self):
+ self.test.criteria = 0
+ self.test.result = 0
+ self.assertEqual(self.test.check_result(),
+ testcase.TestCase.EX_TESTCASE_FAILED)
+
if __name__ == "__main__":
unittest.main(verbosity=2)
diff --git a/functest/tests/unit/core/test_vnf_base.py b/functest/tests/unit/core/test_vnf_base.py
index 96706040d..540cf610d 100644
--- a/functest/tests/unit/core/test_vnf_base.py
+++ b/functest/tests/unit/core/test_vnf_base.py
@@ -23,7 +23,7 @@ class VnfBaseTesting(unittest.TestCase):
self.test.project = "functest"
self.test.start_time = "1"
self.test.stop_time = "5"
- self.test.criteria = ""
+ self.test.result = ""
self.test.details = {"orchestrator": {"status": "PASS",
"result": "",
"duration": 20},
diff --git a/functest/tests/unit/features/test_barometer.py b/functest/tests/unit/features/test_barometer.py
index 62f2e0d6e..8ca463b24 100644
--- a/functest/tests/unit/features/test_barometer.py
+++ b/functest/tests/unit/features/test_barometer.py
@@ -19,36 +19,31 @@ from functest.core import testcase
sys.modules['baro_tests'] = mock.Mock() # noqa
# pylint: disable=wrong-import-position
from functest.opnfv_tests.features import barometer
-from functest.utils import constants
class BarometerTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "barometercollectd"
+ _project_name = "barometer"
+
def setUp(self):
self.barometer = barometer.BarometerCollectd(
- case_name="barometercollectd")
+ case_name=self._case_name, project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.barometer.project_name, "barometer")
- self.assertEqual(self.barometer.case_name, "barometercollectd")
- self.assertEqual(
- self.barometer.repo,
- constants.CONST.__getattribute__('dir_repo_barometer'))
-
- @unittest.skip("JIRA: FUNCTEST-777")
- def test_execute_ko(self):
- # It must be skipped to allow merging
+ self.assertEqual(self.barometer.project_name, self._project_name)
+ self.assertEqual(self.barometer.case_name, self._case_name)
+
+ def test_run_ko(self):
sys.modules['baro_tests'].collectd.main = mock.Mock(return_value=1)
- self.assertEqual(self.barometer.execute(),
+ self.assertEqual(self.barometer.run(),
testcase.TestCase.EX_RUN_ERROR)
- @unittest.skip("JIRA: FUNCTEST-777")
- def test_execute(self):
- # It must be skipped to allow merging
+ def test_run(self):
sys.modules['baro_tests'].collectd.main = mock.Mock(return_value=0)
- self.assertEqual(self.barometer.execute(), testcase.TestCase.EX_OK)
+ self.assertEqual(self.barometer.run(), testcase.TestCase.EX_OK)
if __name__ == "__main__":
diff --git a/functest/tests/unit/features/test_copper.py b/functest/tests/unit/features/test_copper.py
deleted file mode 100644
index b6d187f7a..000000000
--- a/functest/tests/unit/features/test_copper.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-
-# 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
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import copper
-from functest.utils import constants
-
-
-class CopperTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.copper = copper.Copper(case_name="copper-notification")
-
- def test_init(self):
- self.assertEqual(self.copper.project_name, "copper")
- self.assertEqual(self.copper.case_name, "copper-notification")
- self.assertEqual(
- self.copper.repo,
- constants.CONST.__getattribute__("dir_repo_copper"))
- self.assertEqual(
- self.copper.cmd,
- "cd {}/tests && bash run.sh && cd -".format(self.copper.repo))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_doctor.py b/functest/tests/unit/features/test_doctor.py
deleted file mode 100644
index 36bac44f0..000000000
--- a/functest/tests/unit/features/test_doctor.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-
-# 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
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import doctor
-from functest.utils import constants
-
-
-class DoctorTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.doctor = doctor.Doctor(case_name="doctor-notification")
-
- def test_init(self):
- self.assertEqual(self.doctor.project_name, "doctor")
- self.assertEqual(self.doctor.case_name, "doctor-notification")
- self.assertEqual(
- self.doctor.repo,
- constants.CONST.__getattribute__("dir_repo_doctor"))
- self.assertEqual(
- self.doctor.cmd,
- 'cd {}/tests && ./run.sh'.format(self.doctor.repo))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_domino.py b/functest/tests/unit/features/test_domino.py
deleted file mode 100644
index c0bfd14b4..000000000
--- a/functest/tests/unit/features/test_domino.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-
-# 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
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import domino
-from functest.utils import constants
-
-
-class DominoTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.domino = domino.Domino(case_name="domino-multinode")
-
- def test_init(self):
- self.assertEqual(self.domino.project_name, "domino")
- self.assertEqual(self.domino.case_name, "domino-multinode")
- self.assertEqual(
- self.domino.repo,
- constants.CONST.__getattribute__("dir_repo_domino"))
- self.assertEqual(
- self.domino.cmd,
- 'cd {} && ./tests/run_multinode.sh'.format(self.domino.repo))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_netready.py b/functest/tests/unit/features/test_netready.py
deleted file mode 100644
index 47be42034..000000000
--- a/functest/tests/unit/features/test_netready.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-
-# 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
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import netready
-from functest.utils import constants
-
-
-class NetreadyTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.netready = netready.GluonVping(case_name="gluon_vping")
-
- def test_init(self):
- self.assertEqual(self.netready.project_name, "netready")
- self.assertEqual(self.netready.case_name, "gluon_vping")
- self.assertEqual(
- self.netready.repo,
- constants.CONST.__getattribute__("dir_repo_netready"))
- self.assertEqual(
- self.netready.cmd,
- 'cd {}/test/functest && python ./gluon-test-suite.py'.format(
- self.netready.repo))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_odl_sfc.py b/functest/tests/unit/features/test_odl_sfc.py
deleted file mode 100644
index dcdcdff63..000000000
--- a/functest/tests/unit/features/test_odl_sfc.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-
-# 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
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import odl_sfc
-from functest.utils import constants
-
-
-class OpenDaylightSFCTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.odl_sfc = odl_sfc.OpenDaylightSFC(case_name="functest-odl-sfc")
-
- def test_init(self):
- self.assertEqual(self.odl_sfc.project_name, "sfc")
- self.assertEqual(self.odl_sfc.case_name, "functest-odl-sfc")
- self.assertEqual(
- self.odl_sfc.repo,
- constants.CONST.__getattribute__("dir_repo_sfc"))
- dir_sfc_functest = '{}/sfc/tests/functest'.format(self.odl_sfc.repo)
- self.assertEqual(
- self.odl_sfc.cmd,
- 'cd {} && python ./run_tests.py'.format(dir_sfc_functest))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_promise.py b/functest/tests/unit/features/test_promise.py
deleted file mode 100644
index 29b4d4ec8..000000000
--- a/functest/tests/unit/features/test_promise.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-
-# 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
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import promise
-from functest.utils import constants
-
-
-class PromiseTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.promise = promise.Promise(case_name="promise")
-
- def test_init(self):
- self.assertEqual(self.promise.project_name, "promise")
- self.assertEqual(self.promise.case_name, "promise")
- self.assertEqual(
- self.promise.repo,
- constants.CONST.__getattribute__("dir_repo_promise"))
- self.assertEqual(
- self.promise.cmd,
- 'cd {}/promise/test/functest && python ./run_tests.py'.format(
- self.promise.repo))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_sdnvpn.py b/functest/tests/unit/features/test_sdnvpn.py
deleted file mode 100644
index 8fa43fc44..000000000
--- a/functest/tests/unit/features/test_sdnvpn.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-
-# 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
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import sdnvpn
-from functest.utils import constants
-
-
-class SdnVpnTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.sdnvpn = sdnvpn.SdnVpnTests(case_name="bgpvpn")
-
- def test_init(self):
- self.assertEqual(self.sdnvpn.project_name, "sdnvpn")
- self.assertEqual(self.sdnvpn.case_name, "bgpvpn")
- self.assertEqual(
- self.sdnvpn.repo,
- constants.CONST.__getattribute__("dir_repo_sdnvpn"))
- self.assertEqual(
- self.sdnvpn.cmd,
- 'cd {}/sdnvpn/test/functest && python ./run_tests.py'.format(
- self.sdnvpn.repo))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_security_scan.py b/functest/tests/unit/features/test_security_scan.py
deleted file mode 100644
index f0e40159d..000000000
--- a/functest/tests/unit/features/test_security_scan.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python
-
-# 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
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import security_scan
-from functest.utils import constants
-
-
-class SecurityScanTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.sscan = security_scan.SecurityScan(case_name="security_scan")
-
- def test_init(self):
- self.assertEqual(self.sscan.project_name, "securityscanning")
- self.assertEqual(self.sscan.case_name, "security_scan")
- self.assertEqual(
- self.sscan.repo,
- constants.CONST.__getattribute__("dir_repo_securityscan"))
- self.assertEqual(
- self.sscan.cmd, (
- '. {0}/stackrc && cd {1} && '
- 'python security_scan.py --config config.ini && '
- 'cd -'.format(
- constants.CONST.__getattribute__("dir_functest_conf"),
- self.sscan.repo)))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py
index e08deb27d..54d6da72c 100644
--- a/functest/tests/unit/odl/test_odl.py
+++ b/functest/tests/unit/odl/test_odl.py
@@ -90,7 +90,7 @@ class ODLTesting(unittest.TestCase):
os.environ["OS_USERNAME"] = self._os_username
os.environ["OS_PASSWORD"] = self._os_password
os.environ["OS_TENANT_NAME"] = self._os_tenantname
- self.test = odl.ODLTests()
+ self.test = odl.ODLTests(case_name='odl', project_name='functest')
self.defaultargs = {'odlusername': self._odl_username,
'odlpassword': self._odl_password,
'neutronip': self._keystone_ip,
@@ -113,7 +113,8 @@ class ODLParseResultTesting(ODLTesting):
def test_raises_exc(self, mock_method):
with self.assertRaises(DataError):
self.test.parse_results()
- mock_method.assert_called_once_with()
+ mock_method.assert_called_once_with(
+ os.path.join(odl.ODLTests.res_dir, 'output.xml'))
def test_ok(self):
config = {'name': 'dummy', 'starttime': '20161216 16:00:00.000',
@@ -123,7 +124,7 @@ class ODLParseResultTesting(ODLTesting):
with mock.patch('robot.api.ExecutionResult',
return_value=mock.Mock(suite=suite)):
self.test.parse_results()
- self.assertEqual(self.test.criteria, config['status'])
+ self.assertEqual(self.test.result, config['status'])
self.assertEqual(self.test.start_time,
timestamp_to_secs(config['starttime']))
self.assertEqual(self.test.stop_time,
@@ -368,19 +369,10 @@ class ODLRunTesting(ODLTesting):
"""The class testing ODLTests.run()."""
# pylint: disable=missing-docstring
- @classmethod
- def _fake_url_for(cls, service_type='identity'):
- if service_type == 'identity':
- return "http://{}:5000/v2.0".format(
- ODLTesting._keystone_ip)
- elif service_type == 'network':
- return "http://{}:9696".format(ODLTesting._neutron_ip)
- else:
- return None
-
def _test_no_env_var(self, var):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
- side_effect=self._fake_url_for):
+ return_value="http://{}:9696".format(
+ ODLTesting._neutron_ip)):
del os.environ[var]
self.assertEqual(self.test.run(),
testcase.TestCase.EX_RUN_ERROR)
@@ -393,7 +385,8 @@ class ODLRunTesting(ODLTesting):
if 'odlrestconfport' in kwargs else '8181')
with mock.patch('functest.utils.openstack_utils.get_endpoint',
- side_effect=self._fake_url_for):
+ return_value="http://{}:9696".format(
+ ODLTesting._neutron_ip)):
if exception:
self.test.main = mock.Mock(side_effect=exception)
else:
@@ -410,18 +403,15 @@ class ODLRunTesting(ODLTesting):
osusername=self._os_username)
def _test_multiple_suites(self, suites,
- status=testcase.TestCase.EX_OK,
- exception=None, **kwargs):
+ status=testcase.TestCase.EX_OK, **kwargs):
odlip = kwargs['odlip'] if 'odlip' in kwargs else '127.0.0.3'
odlwebport = kwargs['odlwebport'] if 'odlwebport' in kwargs else '8080'
odlrestconfport = (kwargs['odlrestconfport']
if 'odlrestconfport' in kwargs else '8181')
with mock.patch('functest.utils.openstack_utils.get_endpoint',
- side_effect=self._fake_url_for):
- if exception:
- self.test.main = mock.Mock(side_effect=exception)
- else:
- self.test.main = mock.Mock(return_value=status)
+ return_value="http://{}:9696".format(
+ ODLTesting._neutron_ip)):
+ self.test.main = mock.Mock(return_value=status)
self.assertEqual(self.test.run(suites=suites), status)
self.test.main.assert_called_once_with(
suites,
@@ -467,7 +457,8 @@ class ODLRunTesting(ODLTesting):
def test_no_sdn_controller_ip(self):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
- side_effect=self._fake_url_for):
+ return_value="http://{}:9696".format(
+ ODLTesting._neutron_ip)):
self.assertEqual(self.test.run(),
testcase.TestCase.EX_RUN_ERROR)
@@ -492,7 +483,8 @@ class ODLRunTesting(ODLTesting):
def test_apex_no_controller_ip(self):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
- side_effect=self._fake_url_for):
+ return_value="http://{}:9696".format(
+ ODLTesting._neutron_ip)):
os.environ["INSTALLER_TYPE"] = "apex"
self.assertEqual(self.test.run(),
testcase.TestCase.EX_RUN_ERROR)
@@ -506,7 +498,8 @@ class ODLRunTesting(ODLTesting):
def test_netvirt_no_controller_ip(self):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
- side_effect=self._fake_url_for):
+ return_value="http://{}:9696".format(
+ ODLTesting._neutron_ip)):
os.environ["INSTALLER_TYPE"] = "netvirt"
self.assertEqual(self.test.run(),
testcase.TestCase.EX_RUN_ERROR)
@@ -520,7 +513,8 @@ class ODLRunTesting(ODLTesting):
def test_joid_no_controller_ip(self):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
- side_effect=self._fake_url_for):
+ return_value="http://{}:9696".format(
+ ODLTesting._neutron_ip)):
os.environ["INSTALLER_TYPE"] = "joid"
self.assertEqual(self.test.run(),
testcase.TestCase.EX_RUN_ERROR)
@@ -563,7 +557,7 @@ class ODLArgParserTesting(ODLTesting):
self.defaultargs['foo'] = 'bar'
with self.assertRaises(SystemExit):
self.parser.parse_args(["--foo=bar"])
- mock_method.assert_called_once_with()
+ self.assertTrue(mock_method.getvalue().startswith("usage:"))
def _test_arg(self, arg, value):
self.defaultargs[arg] = value
diff --git a/functest/opnfv_tests/vnf/rnc/__init__.py b/functest/tests/unit/openstack/__init__.py
index e69de29bb..e69de29bb 100644
--- a/functest/opnfv_tests/vnf/rnc/__init__.py
+++ b/functest/tests/unit/openstack/__init__.py
diff --git a/functest/tests/unit/opnfv_tests/__init__.py b/functest/tests/unit/openstack/rally/__init__.py
index e69de29bb..e69de29bb 100644
--- a/functest/tests/unit/opnfv_tests/__init__.py
+++ b/functest/tests/unit/openstack/rally/__init__.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py
index fe25dfcf9..fe25dfcf9 100644
--- a/functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py
+++ b/functest/tests/unit/openstack/rally/test_rally.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/__init__.py b/functest/tests/unit/openstack/refstack_client/__init__.py
index e69de29bb..e69de29bb 100644
--- a/functest/tests/unit/opnfv_tests/openstack/__init__.py
+++ b/functest/tests/unit/openstack/refstack_client/__init__.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
index 60e180c9e..60e180c9e 100644
--- a/functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py
+++ b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/rally/__init__.py b/functest/tests/unit/openstack/tempest/__init__.py
index e69de29bb..e69de29bb 100644
--- a/functest/tests/unit/opnfv_tests/openstack/rally/__init__.py
+++ b/functest/tests/unit/openstack/tempest/__init__.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/tempest/test_conf_utils.py b/functest/tests/unit/openstack/tempest/test_conf_utils.py
index 8ca5cc5b6..8ca5cc5b6 100644
--- a/functest/tests/unit/opnfv_tests/openstack/tempest/test_conf_utils.py
+++ b/functest/tests/unit/openstack/tempest/test_conf_utils.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py b/functest/tests/unit/openstack/tempest/test_tempest.py
index 34031b404..e05e5dfac 100644
--- a/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py
+++ b/functest/tests/unit/openstack/tempest/test_tempest.py
@@ -105,7 +105,7 @@ class OSTempestTesting(unittest.TestCase):
self._test_generate_test_list_mode_default('full')
def test_parse_verifier_result_missing_verification_uuid(self):
- self.tempestcommon.VERIFICATION_ID = ''
+ self.tempestcommon.VERIFICATION_ID = None
with self.assertRaises(Exception):
self.tempestcommon.parse_verifier_result()
@@ -169,100 +169,82 @@ class OSTempestTesting(unittest.TestCase):
self.tempestcommon.parse_verifier_result()
mock_method.assert_any_call('test_case_name', 100)
- def test_run_missing_create_tempest_dir(self):
- ret = testcase.TestCase.EX_RUN_ERROR
- with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.path.exists', return_value=False), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.makedirs') as mock_os_makedirs, \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.create_tempest_resources',
- return_value="image_and_flavor"):
- self.assertEqual(self.tempestcommon.run(),
- ret)
- self.assertTrue(mock_os_makedirs.called)
-
- def test_run_missing_configure_tempest(self):
- ret = testcase.TestCase.EX_RUN_ERROR
- ret_ok = testcase.TestCase.EX_OK
- with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.path.exists', return_value=False), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.makedirs') as mock_os_makedirs, \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.create_tempest_resources',
- return_value=ret_ok), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.configure_tempest',
- return_value=ret):
- self.assertEqual(self.tempestcommon.run(),
- ret)
- self.assertTrue(mock_os_makedirs.called)
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.exists', return_value=False)
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs',
+ side_effect=Exception)
+ def test_run_makedirs_ko(self, *args):
+ self.assertEqual(self.tempestcommon.run(),
+ testcase.TestCase.EX_RUN_ERROR)
+
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.exists', return_value=False)
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs')
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.create_tempest_resources', side_effect=Exception)
+ def test_run_create_tempest_resources_ko(self, *args):
+ self.assertEqual(self.tempestcommon.run(),
+ testcase.TestCase.EX_RUN_ERROR)
+
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.exists', return_value=False)
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs')
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.create_tempest_resources', return_value={})
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.configure_tempest', side_effect=Exception)
+ def test_run_configure_tempest_ko(self, *args):
+ self.assertEqual(self.tempestcommon.run(),
+ testcase.TestCase.EX_RUN_ERROR)
+
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.exists', return_value=False)
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs')
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.create_tempest_resources', return_value={})
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.configure_tempest')
+ def _test_run(self, status, *args):
+ self.assertEqual(self.tempestcommon.run(), status)
def test_run_missing_generate_test_list(self):
- ret = testcase.TestCase.EX_RUN_ERROR
- ret_ok = testcase.TestCase.EX_OK
- with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.path.exists', return_value=False), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.makedirs') as mock_os_makedirs, \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.create_tempest_resources',
- return_value=ret_ok), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.configure_tempest',
- return_value=ret_ok), \
- mock.patch.object(self.tempestcommon, 'generate_test_list',
- return_value=ret):
- self.assertEqual(self.tempestcommon.run(),
- ret)
- self.assertTrue(mock_os_makedirs.called)
-
- def test_run_missing_apply_tempest_blacklist(self):
- ret = testcase.TestCase.EX_RUN_ERROR
- ret_ok = testcase.TestCase.EX_OK
- with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.path.exists', return_value=False), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.makedirs') as mock_os_makedirs, \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.create_tempest_resources',
- return_value=ret_ok), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.configure_tempest',
- return_value=ret_ok), \
- mock.patch.object(self.tempestcommon, 'generate_test_list',
- return_value=ret_ok), \
- mock.patch.object(self.tempestcommon, 'apply_tempest_blacklist',
- return_value=ret):
- self.assertEqual(self.tempestcommon.run(),
- ret)
- self.assertTrue(mock_os_makedirs.called)
-
- def test_run_missing_parse_verifier_result(self):
- ret = testcase.TestCase.EX_RUN_ERROR
- ret_ok = testcase.TestCase.EX_OK
- with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.path.exists', return_value=False), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.makedirs') as mock_os_makedirs, \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.create_tempest_resources',
- return_value=ret_ok), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.configure_tempest',
- return_value=ret_ok), \
- mock.patch.object(self.tempestcommon, 'generate_test_list',
- return_value=ret_ok), \
- mock.patch.object(self.tempestcommon, 'apply_tempest_blacklist',
- return_value=ret_ok), \
- mock.patch.object(self.tempestcommon, 'run_verifier_tests',
- return_value=ret_ok), \
- mock.patch.object(self.tempestcommon, 'parse_verifier_result',
- return_value=ret):
- self.assertEqual(self.tempestcommon.run(),
- ret)
- self.assertTrue(mock_os_makedirs.called)
+ with mock.patch.object(self.tempestcommon, 'generate_test_list',
+ side_effect=Exception):
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+
+ def test_run_apply_tempest_blacklist_ko(self):
+ with mock.patch.object(self.tempestcommon, 'generate_test_list'), \
+ mock.patch.object(self.tempestcommon,
+ 'apply_tempest_blacklist',
+ side_effect=Exception()):
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+
+ def test_run_verifier_tests_ko(self, *args):
+ with mock.patch.object(self.tempestcommon, 'generate_test_list'), \
+ mock.patch.object(self.tempestcommon,
+ 'apply_tempest_blacklist'), \
+ mock.patch.object(self.tempestcommon, 'run_verifier_tests',
+ side_effect=Exception()), \
+ mock.patch.object(self.tempestcommon, 'parse_verifier_result',
+ side_effect=Exception):
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+
+ def test_run_parse_verifier_result_ko(self, *args):
+ with mock.patch.object(self.tempestcommon, 'generate_test_list'), \
+ mock.patch.object(self.tempestcommon,
+ 'apply_tempest_blacklist'), \
+ mock.patch.object(self.tempestcommon, 'run_verifier_tests'), \
+ mock.patch.object(self.tempestcommon, 'parse_verifier_result',
+ side_effect=Exception):
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+
+ def test_run(self, *args):
+ with mock.patch.object(self.tempestcommon, 'generate_test_list'), \
+ mock.patch.object(self.tempestcommon,
+ 'apply_tempest_blacklist'), \
+ mock.patch.object(self.tempestcommon, 'run_verifier_tests'), \
+ mock.patch.object(self.tempestcommon, 'parse_verifier_result'):
+ self._test_run(testcase.TestCase.EX_OK)
if __name__ == "__main__":
diff --git a/functest/tests/unit/opnfv_tests/vnf/ims/__init__.py b/functest/tests/unit/opnfv_tests/vnf/ims/__init__.py
deleted file mode 100644
index e69de29bb..000000000
--- a/functest/tests/unit/opnfv_tests/vnf/ims/__init__.py
+++ /dev/null
diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py
index eb241e5d0..573fcb70f 100644
--- a/functest/tests/unit/utils/test_functest_utils.py
+++ b/functest/tests/unit/utils/test_functest_utils.py
@@ -41,8 +41,8 @@ class FunctestUtilsTesting(unittest.TestCase):
self.status = 'test_status'
self.details = 'test_details'
self.db_url = 'test_db_url'
- self.success_rate = 2.0
- self.criteria = 'test_criteria==2.0'
+ self.criteria = 50
+ self.result = 75
self.start_date = 1482624000
self.stop_date = 1482624000
self.start_time = time.time()
@@ -54,7 +54,8 @@ class FunctestUtilsTesting(unittest.TestCase):
self.cmd = 'test_cmd'
self.output_file = 'test_output_file'
self.testname = 'testname'
- self.testcase_dict = {'name': 'testname', 'criteria': self.criteria}
+ self.testcase_dict = {'case_name': 'testname',
+ 'criteria': self.criteria}
self.parameter = 'general.openstack.image_name'
self.config_yaml = 'test_config_yaml-'
self.db_url_env = 'http://foo/testdb'
@@ -278,7 +279,7 @@ class FunctestUtilsTesting(unittest.TestCase):
as mock_logger_error:
functest_utils.push_results_to_db(self.project, self.case_name,
self.start_date, self.stop_date,
- self.criteria, self.details)
+ self.result, self.details)
mock_logger_error.assert_called_once_with("Please set env var: " +
str("\'" + env_var +
"\'"))
@@ -310,7 +311,7 @@ class FunctestUtilsTesting(unittest.TestCase):
push_results_to_db(self.project, self.case_name,
self.start_date,
self.stop_date,
- self.criteria, self.details))
+ self.result, self.details))
mock_logger_error.assert_called_once_with(test_utils.
RegexMatch("Pushing "
"Result to"
@@ -333,7 +334,7 @@ class FunctestUtilsTesting(unittest.TestCase):
push_results_to_db(self.project, self.case_name,
self.start_date,
self.stop_date,
- self.criteria, self.details))
+ self.result, self.details))
self.assertTrue(mock_logger_error.called)
def test_push_results_to_db_default(self):
@@ -348,7 +349,7 @@ class FunctestUtilsTesting(unittest.TestCase):
push_results_to_db(self.project, self.case_name,
self.start_date,
self.stop_date,
- self.criteria, self.details))
+ self.result, self.details))
readline = 0
test_ip = ['10.1.23.4', '10.1.14.15', '10.1.16.15']
@@ -565,7 +566,7 @@ class FunctestUtilsTesting(unittest.TestCase):
as mock_criteria:
mock_criteria.return_value = self.criteria
resp = functest_utils.check_success_rate(self.case_name,
- self.success_rate)
+ self.result)
self.assertEqual(resp, 'PASS')
def test_check_success_rate_failed(self):
@@ -573,7 +574,7 @@ class FunctestUtilsTesting(unittest.TestCase):
as mock_criteria:
mock_criteria.return_value = self.criteria
resp = functest_utils.check_success_rate(self.case_name,
- 3.0)
+ 0)
self.assertEqual(resp, 'FAIL')
# TODO: merge_dicts
diff --git a/functest/tests/unit/opnfv_tests/openstack/refstack_client/__init__.py b/functest/tests/unit/vnf/__init__.py
index e69de29bb..e69de29bb 100644
--- a/functest/tests/unit/opnfv_tests/openstack/refstack_client/__init__.py
+++ b/functest/tests/unit/vnf/__init__.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/tempest/__init__.py b/functest/tests/unit/vnf/ims/__init__.py
index e69de29bb..e69de29bb 100644
--- a/functest/tests/unit/opnfv_tests/openstack/tempest/__init__.py
+++ b/functest/tests/unit/vnf/ims/__init__.py
diff --git a/functest/tests/unit/opnfv_tests/vnf/ims/test_clearwater.py b/functest/tests/unit/vnf/ims/test_clearwater.py
index 18bebfdff..18bebfdff 100644
--- a/functest/tests/unit/opnfv_tests/vnf/ims/test_clearwater.py
+++ b/functest/tests/unit/vnf/ims/test_clearwater.py
diff --git a/functest/tests/unit/opnfv_tests/vnf/ims/test_cloudify_ims.py b/functest/tests/unit/vnf/ims/test_cloudify_ims.py
index f47ea865e..f47ea865e 100644
--- a/functest/tests/unit/opnfv_tests/vnf/ims/test_cloudify_ims.py
+++ b/functest/tests/unit/vnf/ims/test_cloudify_ims.py
diff --git a/functest/tests/unit/opnfv_tests/vnf/ims/test_ims_base.by b/functest/tests/unit/vnf/ims/test_ims_base.py
index 9440bcdf3..e283199c3 100644
--- a/functest/tests/unit/opnfv_tests/vnf/ims/test_ims_base.by
+++ b/functest/tests/unit/vnf/ims/test_ims_base.py
@@ -10,7 +10,7 @@ import unittest
import mock
-from functest.opnfv_tests.vnf.ims import ims_base
+from functest.opnfv_tests.vnf.ims import clearwater_ims_base as ims_base
class ClearwaterOnBoardingBaseTesting(unittest.TestCase):
@@ -38,8 +38,8 @@ class ClearwaterOnBoardingBaseTesting(unittest.TestCase):
self.mock_post_200.configure_mock(**attrs)
def test_create_ellis_number_failure(self):
- with mock.patch('functest.opnfv_tests.vnf.ims.ims_base.'
- 'requests.post',
+ with mock.patch('functest.opnfv_tests.vnf.ims.'
+ 'clearwater_ims_base.requests.post',
return_value=self.mock_post_500), \
self.assertRaises(Exception) as context:
self.ims_vnf.create_ellis_number()
diff --git a/functest/tests/unit/opnfv_tests/vnf/ims/test_orchestrator_cloudify.py b/functest/tests/unit/vnf/ims/test_orchestrator_cloudify.py
index bf6d483f7..bf6d483f7 100644
--- a/functest/tests/unit/opnfv_tests/vnf/ims/test_orchestrator_cloudify.py
+++ b/functest/tests/unit/vnf/ims/test_orchestrator_cloudify.py
diff --git a/functest/tests/unit/opnfv_tests/vnf/__init__.py b/functest/tests/unit/vnf/rnc/__init__.py
index e69de29bb..e69de29bb 100644
--- a/functest/tests/unit/opnfv_tests/vnf/__init__.py
+++ b/functest/tests/unit/vnf/rnc/__init__.py
diff --git a/functest/utils/decorators.py b/functest/utils/decorators.py
index 276235d96..46ffe35d1 100644
--- a/functest/utils/decorators.py
+++ b/functest/utils/decorators.py
@@ -1,37 +1,42 @@
#!/usr/bin/env python
+# pylint: disable=missing-docstring
+
import errno
-import mock
import os
-import requests.sessions
import urlparse
+import mock
+import requests.sessions
+
def can_dump_request_to_file(method):
def dump_preparedrequest(request, **kwargs):
+ # pylint: disable=unused-argument
parseresult = urlparse.urlparse(request.url)
if parseresult.scheme == "file":
try:
- os.makedirs(parseresult.path)
- except OSError as e:
- if e.errno != errno.EEXIST:
+ dirname = os.path.dirname(parseresult.path)
+ os.makedirs(dirname)
+ except OSError as ex:
+ if ex.errno != errno.EEXIST:
raise
- with open(os.path.join(parseresult.path, 'dump.txt'), 'a') as f:
+ with open(parseresult.path, 'a') as dumpfile:
headers = ""
for key in request.headers:
headers += key + " " + request.headers[key] + "\n"
message = "{} {}\n{}\n{}\n\n\n".format(
request.method, request.url, headers, request.body)
- f.write(message)
+ dumpfile.write(message)
return mock.Mock()
def patch_request(method, url, **kwargs):
with requests.sessions.Session() as session:
parseresult = urlparse.urlparse(url)
if parseresult.scheme == "file":
- with mock.patch.object(
- session, 'send', side_effect=dump_preparedrequest):
+ with mock.patch.object(session, 'send',
+ side_effect=dump_preparedrequest):
return session.request(method=method, url=url, **kwargs)
else:
return session.request(method=method, url=url, **kwargs)
diff --git a/functest/utils/functest_logger.py b/functest/utils/functest_logger.py
index 555e9c28c..ba52829f7 100644
--- a/functest/utils/functest_logger.py
+++ b/functest/utils/functest_logger.py
@@ -41,6 +41,13 @@ ignore = ["paramiko",
class Logger(object):
+ instance = None
+
+ def __new__(cls, logger_name):
+ if cls.instance is None:
+ cls.instance = object.__new__(cls)
+ return cls.instance
+
def __init__(self, logger_name):
self.setup_logging()
self.logger = logging.getLogger(logger_name)
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py
index 7cc5029d9..7d993cbfc 100644
--- a/functest/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -192,12 +192,12 @@ def logger_test_results(project, case_name, status, details):
@decorators.can_dump_request_to_file
def push_results_to_db(project, case_name,
- start_date, stop_date, criteria, details):
+ start_date, stop_date, result, details):
"""
POST results to the Result target DB
"""
# Retrieve params from CI and conf
- url = get_db_url() + "/results"
+ url = get_db_url()
try:
installer = os.environ['INSTALLER_TYPE']
@@ -213,7 +213,7 @@ def push_results_to_db(project, case_name,
params = {"project_name": project, "case_name": case_name,
"pod_name": pod_name, "installer": installer,
- "version": version, "scenario": scenario, "criteria": criteria,
+ "version": version, "scenario": scenario, "criteria": result,
"build_tag": build_tag, "start_date": test_start,
"stop_date": test_stop, "details": details}
@@ -248,7 +248,7 @@ def push_results_to_db(project, case_name,
'pod': pod_name,
'v': version,
's': scenario,
- 'c': criteria,
+ 'c': result,
't': build_tag,
'd': details,
'error': e
@@ -337,7 +337,7 @@ def get_dict_by_test(testname):
for dic_tier in testcases_yaml.get("tiers"):
for dic_testcase in dic_tier['testcases']:
- if dic_testcase['name'] == testname:
+ if dic_testcase['case_name'] == testname:
return dic_testcase
logger.error('Project %s is not defined in testcases.yaml' % testname)
@@ -379,23 +379,14 @@ def get_functest_config(parameter):
return get_parameter_from_yaml(parameter, yaml_)
-def check_success_rate(case_name, success_rate):
- success_rate = float(success_rate)
+def check_success_rate(case_name, result):
+ # It should be removed as TestCase tests criteria
+ # and result.
+ logger.warning('check_success_rate will be removed soon')
criteria = get_criteria_by_test(case_name)
-
- def get_criteria_value(op):
- return float(criteria.split(op)[1].rstrip('%'))
-
- status = 'FAIL'
- ops = ['==', '>=']
- for op in ops:
- if op in criteria:
- c_value = get_criteria_value(op)
- if eval("%s %s %s" % (success_rate, op, c_value)):
- status = 'PASS'
- break
-
- return status
+ if type(criteria) == int and result >= criteria:
+ return 'PASS'
+ return 'FAIL'
def merge_dicts(dict1, dict2):
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index 4663f7ba6..929a761e0 100644
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -1394,6 +1394,15 @@ def create_tenant(keystone_client, tenant_name, tenant_description):
return None
+def get_or_create_tenant(keystone_client, tenant_name, tenant_description):
+ tenant_id = get_tenant_id(keystone_client, tenant_name)
+ if not tenant_id:
+ tenant_id = create_tenant(keystone_client, tenant_name,
+ tenant_description)
+
+ return tenant_id
+
+
def create_user(keystone_client, user_name, user_password,
user_email, tenant_id):
try:
@@ -1417,6 +1426,15 @@ def create_user(keystone_client, user_name, user_password,
return None
+def get_or_create_user(keystone_client, user_name, user_password,
+ tenant_id, user_email=None):
+ user_id = get_user_id(keystone_client, user_name)
+ if not user_id:
+ user_id = create_user(keystone_client, user_name, user_password,
+ user_email, tenant_id)
+ return user_id
+
+
def add_role_user(keystone_client, user_id, role_id, tenant_id):
try:
if is_keystone_v3():
diff --git a/requirements.txt b/requirements.txt
index ee629eab8..92f16bcca 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -31,3 +31,4 @@ dnspython
Pillow==3.3.0
click==6.6
openbaton-cli==2.2.1-beta7
+mock==1.3.0
diff --git a/run_unit_tests.sh b/run_unit_tests.sh
index 917c8eee8..9780de7ac 100755
--- a/run_unit_tests.sh
+++ b/run_unit_tests.sh
@@ -31,21 +31,10 @@ pip install releng-unittests/modules/
rm -fr releng-unittests
export CONFIG_FUNCTEST_YAML=$(pwd)/functest/ci/config_functest.yaml
-# unit tests
-# TODO: remove cover-erase
-# To be deleted when all functest packages will be listed
nosetests --with-xunit \
--with-coverage \
- --cover-erase \
--cover-tests \
- --cover-package=functest.ci \
- --cover-package=functest.cli \
- --cover-package=functest.core \
- --cover-package=functest.opnfv_tests.sdn.odl.odl \
- --cover-package=functest.opnfv_tests.vnf.ims \
- --cover-package=functest.utils \
- --cover-package=functest.opnfv_tests.features \
- --cover-package=functest.opnfv_tests.openstack \
+ --cover-package=functest \
--cover-xml \
--cover-html \
--log-config=$(pwd)/functest/tests/unit/test_logging.ini \