diff options
46 files changed, 671 insertions, 438 deletions
@@ -60,3 +60,8 @@ docs/_build/ # PyBuilder target/ + +*~ +.*.sw? +/docs_build/ +/docs_output/ @@ -17,7 +17,6 @@ Nauman Ahad nauman.ahad@xflowresearch.com Prabu Kuppuswamy prabu.kuppuswamy@spirent.com Prakash Ramchandran prakash.ramchandran@huawei.com Trevor Cooper trevor.cooper@intel.com -Vikram Dham vikram@kamboi.com Wenjing Chu chu.wenjing@gmail.com Yujun Zhang zhang.yujunz@zte.com.cn @@ -25,6 +24,7 @@ Link to TSC approval of the project: - http://meetbot.opnfv.org/meetings/opnfv-meeting/2015/opnfv-meeting.2015-01-27-14.59.html -Link(s) to approval of additional committers: +Link(s) to approval of committers update: - http://lists.opnfv.org/pipermail/opnfv-tsc/2016-July/002745.html +- http://lists.opnfv.org/pipermail/opnfv-tsc/2016-July/002755.html diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..980a15ac --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + 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. diff --git a/docs/apidocs/.keep b/docs/apidocs/.keep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/docs/apidocs/.keep diff --git a/docs/user_guides/02-installation.rst b/docs/configguide/configuration.rst index 2f2ecf96..f29947d5 100644 --- a/docs/user_guides/02-installation.rst +++ b/docs/configguide/configuration.rst @@ -1,35 +1,28 @@ -Installation -============ - .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. http://creativecommons.org/licenses/by/4.0 -.. (c) <optionally add copywriters name> -.. two dots create a comment. please leave this logo at the top of each of your rst files. -.. image:: ../etc/opnfv-logo.png - :height: 40 - :width: 200 - :alt: OPNFV - :align: left -.. these two pipes are to seperate the logo from the first title +.. (c) 2015 Dell Inc. +.. (c) 2016 ZTE Corp. + -| +Qtip configuration +================== -QTIP currently supports by using a Docker image or by pulling the repo from the upstream -repository found at https://git.opnfv.org/qtip. Detailed steps about setting up QTIP using both of these options -can be found below. +QTIP currently supports by using a Docker image or by pulling the repo from +the upstream repository found at https://git.opnfv.org/qtip. Detailed steps +about setting up QTIP using both of these options can be found below. -To use QTIP you should have access to an OpenStack environment, -with at least Nova, Neutron, Glance, Keystone and Heat installed. +To use QTIP you should have access to an OpenStack environment, with at least +Nova, Neutron, Glance, Keystone and Heat installed. Add a brief introduction +to configure OPNFV with this specific installer -The steps needed to run QTIP are: -Running QTIP by pulling the upstream code ------------------------------------------ +Pre-configuration activities +---------------------------- -.. _install-dependencies: Setting QTIP framework on Ubuntu 14.04 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Install dependencies: :: @@ -46,96 +39,116 @@ Download source code and install python dependencies: git clone https://git.opnfv.org/qtip cd qtip + Installing QTIP using Docker ---------------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -QTIP has a Docker images on the docker hub which can be pull after docker has been installed. +QTIP has a Docker images on the docker hub. Pulling opnfv/qtip docker image +from docker hub: +:: -Installing Docker -^^^^^^^^^^^^^^^^^ -The first step is to install docker: + sudo docker pull opnfv/qtip + +Verify that opnfv/qtip has been downloaded. It should be listed as an image by +running the following command. :: - sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D + sudo docker images + +Run the Docker instance: +:: + docker run opnfv/qtip -i -t bash -Add an entry for your Ubuntu operating system +Now you are in the container and QTIP can be found in the /repos/qtip and can +be navigated to using the following command. :: - Open the /etc/apt/sources.list.d/docker.list file in your favorite editor. + cd repos/qtip -If the file doesn’t exist, create it. -Remove any existing entries. +OpenStack parameters and credentials +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Add an entry for your Ubuntu operating system. -On Ubuntu Trusty 14.04 (LTS) +Environment variables +""""""""""""""""""""" + +Before running QTIP it is necessary to export OpenStack environment variables +from the OpenStack *openrc* file. This can be done by running the following +command. :: - deb https://apt.dockerproject.org/repo ubuntu-trusty main + source get_env_info.sh -n {INSTALLER_TYPE} -i {INSTALLER_IP} + source opnfv-creds.sh -Update the package manager +This provides a ``opnfv-creds.sh`` file which can be sources to get the +environment variables. For running QTIP manually, it is also necessary to +export the installer type. :: - sudo apt-get update + export INSTALLER_TYPE="{installer-type}" -Install Docker: -:: - sudo apt-get install docker-engine +QTIP default key pair +"""""""""""""""""""""" -Starting Docker Daemon: -:: +QTIP uses a SSH key pair to connect to the guest image. This key pair can +be found in the ``data/`` directory. - sudo service docker start -Pulling opnfv/qtip docker image from docker hub: -:: +Hardware configuration +---------------------- - sudo docker pull opnfv/qtip +Qtip does not have specific hardware requriements, and it can runs over any +OPNFV installer. -Verify that opnfv/qtip has been downloaded. It should be listed as an image by running the following command. -:: - sudo docker images +Jumphost configuration +---------------------- -Run the Docker instance: +Installer Docker on Jumphost, which is used for running Qtip image. + +The first step is to install docker: :: - docker run opnfv/qtip -i -t bash + sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 + --recv-keys 58118E89F3A912897C070ADBF76221572C52609D -Now you are in the container and QTIP can be found in the /repos/qtip and can be navigated to using the following command. +Add an entry for your Ubuntu operating system: :: - cd repos/qtip + Open the /etc/apt/sources.list.d/docker.list file in your favorite editor. +If the file doesn’t exist, create it. -OpenStack parameters and credentials ------------------------------------- +Remove any existing entries. +Add an entry for your Ubuntu operating system. -Environment variables -^^^^^^^^^^^^^^^^^^^^^ -Before running QTIP it is necessary to export OpenStack environment variables -from the OpenStack *openrc* file. This can be done by running the following command. +On Ubuntu Trusty 14.04 (LTS) :: - source get_env_info.sh -n {INSTALLER_TYPE} -i {INSTALLER_IP} - source opnfv-creds.sh + deb https://apt.dockerproject.org/repo ubuntu-trusty main -This provides a ``opnfv-creds.sh`` file which can be sources to get the environment variables. -For running QTIP manually, it is also necessary to export the installer type. :: +Update the package manager +:: - export INSTALLER_TYPE="{installer-type}" + sudo apt-get update -QTIP default key pair -^^^^^^^^^^^^^^^^^^^^^^^^^^ -QTIP uses a SSH key pair to connect to the guest image. This key pair can -be found in the ``data/`` directory. +Install Docker: +:: -Examples --------- -QTIP Has been made with the intention of requiring minimal interaction from the user. + sudo apt-get install docker-engine + +Starting Docker Daemon: +:: + + sudo service docker start + + +Platform components configuration +--------------------------------- +Describe the configuration of each component in the installer diff --git a/docs/configguide/index.rst b/docs/configguide/index.rst new file mode 100644 index 00000000..e8b6f4e1 --- /dev/null +++ b/docs/configguide/index.rst @@ -0,0 +1,13 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) 2015 Dell Inc. +.. (c) 2016 ZTE Corp. + +**************** +QTIP Configguide +**************** + +.. toctree:: + :maxdepth: 2 + + ./configuration.rst diff --git a/docs/etc/conf.py b/docs/etc/conf.py deleted file mode 100644 index 65e85db9..00000000 --- a/docs/etc/conf.py +++ /dev/null @@ -1,31 +0,0 @@ -import datetime - - -try: - __import__('imp').find_module('sphinx.ext.numfig') - extensions = ['sphinx.ext.numfig'] -except ImportError: - # 'pip install sphinx_numfig' - extensions = ['sphinx_numfig'] - -# numfig: -number_figures = True -figure_caption_prefix = "Fig." - -source_suffix = '.rst' -master_doc = 'index' -pygments_style = 'sphinx' -html_use_index = False - -pdf_documents = [('index', u'OPNFV', u'OPNFV Project', u'OPNFV')] -pdf_fit_mode = "shrink" -pdf_stylesheets = ['sphinx', 'kerning', 'a4'] - -latex_elements = { - 'printindex': '', -} - -project = u'OPNFV: Template documentation config' -copyright = u'%s, OPNFV' % datetime.date.today().year -version = u'1.0.0' -release = u'1.0.0' diff --git a/docs/etc/opnfv-logo.png b/docs/etc/opnfv-logo.png Binary files differdeleted file mode 100644 index 1519503e..00000000 --- a/docs/etc/opnfv-logo.png +++ /dev/null diff --git a/docs/how-to-use-docs/documentation-example.rst b/docs/how-to-use-docs/documentation-example.rst deleted file mode 100644 index 89b95075..00000000 --- a/docs/how-to-use-docs/documentation-example.rst +++ /dev/null @@ -1,87 +0,0 @@ -.. two dots create a comment. please leave this logo at the top of each of your rst files. -.. image:: ../etc/opnfv-logo.png - :height: 40 - :width: 200 - :alt: OPNFV - :align: left -.. these two pipes are to seperate the logo from the first title -| -| -How to create documentation for your OPNFV project -================================================== - -this is the directory structure of the docs/ directory that can be found in the root of your project directory - -.. code-block:: bash - - ./etc - ./etc/opnfv-logo.png - ./etc/conf.py - ./how-to-use-docs - ./how-to-use-docs/documentation-example.rst - ./how-to-use-docs/index.rst - -To create your own documentation, Create any number of directories (depending on your need) -and place in each of them an index.rst. -This index file must refence your other rst files. - -* Here is an example index.rst - -.. code-block:: bash - - Example Documentation table of contents - ======================================= - - Contents: - - .. toctree:: - :numbered: - :maxdepth: 4 - - documentation-example.rst - - Indices and tables - ================== - - * :ref:`search` - - Revision: _sha1_ - - Build date: |today| - - -The Sphinx Build -================ - -When you push documentation changes to gerrit a jenkins job will create html documentation. - -* Verify Jobs -For verify jobs a link to the documentation will show up as a comment in gerrit for you to see the result. - -* Merge jobs - -Once you are happy with the look of your documentation you can submit the patchset the merge job will -copy the output of each documentation directory to http://artifacts.opnfv.org/$project/docs/$name_of_your_folder/index.html - -Here are some quick examples of how to use rst markup - -This is a headline:: - - here is some code, note that it is indented - -links are easy to add: Here is a link to sphinx, the tool that we are using to generate documetation http://sphinx-doc.org/ - -* Bulleted Items - - **this will be bold** - -.. code-block:: bash - - echo "Heres is a code block with bash syntax highlighting" - - -Leave these at the bottom of each of your documents they are used internally - -Revision: _sha1_ - -Build date: |today| diff --git a/docs/how-to-use-docs/index.rst b/docs/how-to-use-docs/index.rst deleted file mode 100644 index 713599c0..00000000 --- a/docs/how-to-use-docs/index.rst +++ /dev/null @@ -1,34 +0,0 @@ -.. OPNFV Release Engineering documentation, created by - sphinx-quickstart on Tue Jun 9 19:12:31 2015. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -.. image:: ../etc/opnfv-logo.png - :height: 40 - :width: 200 - :alt: OPNFV - :align: left - -Example Documentation table of contents -======================================= - -Contents: - -.. toctree:: - :numbered: - :maxdepth: 4 - - documentation-example.rst - 01-introduction.rst - 02-methodology.rst - 03-usage-guide.rst - - -Indices and tables -================== - -* :ref:`search` - -Revision: _sha1_ - -Build date: |today| diff --git a/docs/roadmap/index.rst b/docs/roadmap/index.rst new file mode 100644 index 00000000..4e30d5ae --- /dev/null +++ b/docs/roadmap/index.rst @@ -0,0 +1,13 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) 2015 Dell Inc. +.. (c) 2016 ZTE Corp. + +************ +Qtip Roadmap +************ + +.. toctree:: + :maxdepth: 2 + + ./roadmap.rst diff --git a/docs/roadmap.rst b/docs/roadmap/roadmap.rst index 42caec92..42caec92 100644 --- a/docs/roadmap.rst +++ b/docs/roadmap/roadmap.rst diff --git a/docs/templates/index.rst b/docs/templates/index.rst index c893df6f..1a8bc649 100644 --- a/docs/templates/index.rst +++ b/docs/templates/index.rst @@ -1,30 +1,13 @@ -.. OPNFV Release Engineering documentation, created by - sphinx-quickstart on Tue Jun 9 19:12:31 2015. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) 2015 Dell Inc. +.. (c) 2016 ZTE Corp. -.. image:: ../etc/opnfv-logo.png - :height: 40 - :width: 200 - :alt: OPNFV - :align: left - -Example Documentation table of contents -======================================= - -Contents: +************** +QTIP Templates +************** .. toctree:: - :numbered: - :maxdepth: 4 - - testcase_description_v2_template.rst - -Indices and tables -================== - -* :ref:`search` - -Revision: _sha1_ + :maxdepth: 2 -Build date: |today| + ./testcase_description_v2_template.rst diff --git a/docs/sample_config.yaml b/docs/templates/sample_config.yaml index 8dcaa11c..8dcaa11c 100644 --- a/docs/sample_config.yaml +++ b/docs/templates/sample_config.yaml diff --git a/docs/user_guides/01-introduction.rst b/docs/user_guides/01-introduction.rst deleted file mode 100644 index 6322d092..00000000 --- a/docs/user_guides/01-introduction.rst +++ /dev/null @@ -1,40 +0,0 @@ -Introduction -============ - -.. This work is licensed under a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) <optionally add copywriters name> -.. two dots create a comment. please leave this logo at the top of each of your rst files. -.. image:: ../etc/opnfv-logo.png - :height: 40 - :width: 200 - :alt: OPNFV - :align: left -.. these two pipes are to seperate the logo from the first title - -| - -**Welcome to QTIP's documentation !** - -.. _QTIP: https://wiki.opnfv.org/platform_performance_benchmarking - -QTIP_ is an OPNFV Project. - -QTIP aims to benchmark OPNFV platforms through a "Bottom up" approach, testing bare-metal components first. - -The overall problem this project tries to solve is the general characterization of an OPNFV platform. -It will focus on general performance questions that are common to the platform itself, or applicable to multiple OPNFV use cases. -QTIP will provide the capability to quantify a platform's performance behavior in a standardized, rigorous, and open way. - -The *QTIP* framework is deployed in the Dell OPNFV community lab. It is -infrastructure and application independent. - -.. _Pharos: https://wiki.opnfv.org/pharos -.. seealso:: Pharos_ for information on OPNFV community labs. - -**Contact QTIP** - -Feedback? `Contact us`_ - -.. _Contact us: opnfv-users@lists.opnfv.org - diff --git a/docs/user_guides/index.rst b/docs/user_guides/index.rst deleted file mode 100644 index da14761c..00000000 --- a/docs/user_guides/index.rst +++ /dev/null @@ -1,17 +0,0 @@ -================================ -QTIP Framework Documentation -================================= - -.. toctree:: - :numbered: - :maxdepth: 4 - - 01-introduction.rst - 02-installation.rst - 03-usage-guide.rst - test_cases/01-compute_testcases.rst - test_cases/02-network_testcases.rst - test_cases/03-storage_testcases.rst - -Revision: _sha1_ -Build date: |today| diff --git a/docs/user_guides/test_cases/01-compute_testcases.rst b/docs/userguide/01-compute.rst index b3531298..6e6a7a04 100644 --- a/docs/user_guides/test_cases/01-compute_testcases.rst +++ b/docs/userguide/01-compute.rst @@ -1,19 +1,12 @@ -Compute test cases -================== - .. This wonk is licensed under a Creative Commons Attribution 4.0 International License. .. http://cneativecommons.org/licenses/by/4.0 -.. (c) <optionally add copywniters name> -.. two dots cneate a comment. please leave this logo at the top of each of your rst files. +.. (c) 2015 Dell Inc. +.. (c) 2016 ZTE Corp. -.. image:: ../../etc/opnfv-logo.png - :height: 40 - :width: 200 - :alt: OPNFV - :align: left -.. these two pipes ane to seperate the logo from the first title -| +Compute test cases +================== + Introduction ------------ diff --git a/docs/user_guides/test_cases/02-network_testcases.rst b/docs/userguide/02-network.rst index 45c2d824..bc475ad3 100644 --- a/docs/user_guides/test_cases/02-network_testcases.rst +++ b/docs/userguide/02-network.rst @@ -1,18 +1,11 @@ -Network test cases -================== - .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. http://creativecommons.org/licenses/by/4.0 -.. (c) <optionally add copywriters name> -.. two dots create a comment. please leave this logo at the top of each of your rst files. -.. image:: ../../etc/opnfv-logo.png - :height: 40 - :width: 200 - :alt: OPNFV - :align: left -.. these two pipes are to seperate the logo from the first title - -| +.. (c) 2015 Dell Inc. +.. (c) 2016 ZTE Corp. + + +Network test cases +================== QTIP uses IPerf3 as the main tool for testing the network throughput. There are three tests that are run through the QTIP framework. diff --git a/docs/user_guides/test_cases/03-storage_testcases.rst b/docs/userguide/03-storage.rst index cd557683..ea3bb4f3 100644 --- a/docs/user_guides/test_cases/03-storage_testcases.rst +++ b/docs/userguide/03-storage.rst @@ -1,18 +1,11 @@ -Storage test cases -================== - .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. http://creativecommons.org/licenses/by/4.0 -.. (c) <optionally add copywriters name> -.. two dots create a comment. please leave this logo at the top of each of your rst files. -.. image:: ../../etc/opnfv-logo.png - :height: 40 - :width: 200 - :alt: OPNFV - :align: left -.. these two pipes are to seperate the logo from the first title +.. (c) 2015 Dell Inc. +.. (c) 2016 ZTE Corp. -| + +Storage test cases +================== The QTIP benchmark suite aims to evaluate storage components within an OPNFV platform. For Brahamaputra release, FIO would evaluate File System performance for the host machine. @@ -36,4 +29,3 @@ The FIO Job would consist of: 6. Block size :4K For this Job, I/O per second would be measured along mean I/O latency to provide storage performance numbers. - diff --git a/docs/userguide/index.rst b/docs/userguide/index.rst new file mode 100644 index 00000000..fe24293a --- /dev/null +++ b/docs/userguide/index.rst @@ -0,0 +1,21 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) 2015 Dell Inc. +.. (c) 2016 ZTE Corp. + + +************** +QTIP Userguide +************** + +Colorado 1.0 +------------ + +.. toctree:: + :maxdepth: 2 + + ./overview.rst + ./introduction.rst + ./01-compute_testcases.rst + ./02-network_testcases.rst + ./03-storage_testcases.rst diff --git a/docs/user_guides/03-usage-guide.rst b/docs/userguide/introduction.rst index 56cc16b3..d3bba51d 100644 --- a/docs/user_guides/03-usage-guide.rst +++ b/docs/userguide/introduction.rst @@ -1,18 +1,12 @@ -Guide to run QTIP: -================== - .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. http://creativecommons.org/licenses/by/4.0 -.. (c) <optionally add copywriters name> -.. two dots create a comment. please leave this logo at the top of each of your rst files. -.. image:: ../etc/opnfv-logo.png - :height: 40 - :width: 200 - :alt: OPNFV - :align: left -.. these two pipes are to seperate the logo from the first title +.. (c) 2015 Dell Inc. +.. (c) 2016 ZTE Corp. + -| +***************** +Qtip Introduction +***************** This guide will serve as a first step to familiarize the user with how to run QTIP the first time when the user clones QTIP on to their host machine. @@ -341,4 +335,3 @@ Running QTIP on the using `default` as the pod name and for the `storage` suite Results: -------- QTIP generates results in the `results/` directory are listed down under the particularly benchmark name. So all the results for dhrystone would be listed and time stamped. - diff --git a/docs/userguide/overview.rst b/docs/userguide/overview.rst new file mode 100644 index 00000000..82b7de91 --- /dev/null +++ b/docs/userguide/overview.rst @@ -0,0 +1,22 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) 2015 Dell Inc. +.. (c) 2016 ZTE Corp. + + +******** +Overview +******** + +.. _QTIP: https://wiki.opnfv.org/platform_performance_benchmarking + +QTIP_ is an OPNFV Project. + +QTIP aims to benchmark OPNFV platforms through a "Bottom up" approach, testing +bare-metal components first. + +The overall problem this project tries to solve is the general +characterization of an OPNFV platform. It will focus on general performance +questions that are common to the platform itself, or applicable to multiple +OPNFV use cases. QTIP will provide the capability to quantify a platform's +performance behavior in a standardized, rigorous, and open way. diff --git a/func/cli.py b/func/cli.py index 5e8f02cf..4613b507 100644 --- a/func/cli.py +++ b/func/cli.py @@ -54,13 +54,15 @@ class cli: @staticmethod def _parse_args(args): parser = argparse.ArgumentParser() - parser.add_argument('-l ', '--lab', help='Name of Lab on which being tested, These can' + parser.add_argument('-l ', '--lab', required=True, help='Name of Lab ' + 'on which being tested, These can' 'be found in the test_cases/ directory. Please ' 'ensure that you have edited the respective files ' 'before using them. For testing other than through Jenkins' ' The user should list default after -l . all the fields in' ' the files are necessary and should be filled') - parser.add_argument('-f', '--file', help='File in test_list with the list of tests. there are three files' + parser.add_argument('-f', '--file', required=True, help='File in ' + 'test_list with the list of tests. there are three files' '\n compute ' '\n storage ' '\n network ' diff --git a/func/env_setup.py b/func/env_setup.py index fdddf49a..1f86f0ea 100644 --- a/func/env_setup.py +++ b/func/env_setup.py @@ -105,16 +105,18 @@ class Env_setup: print 'Retrying SSH %s' % infinity @staticmethod - def ping_test(lister): - + def ping_test(lister, attempts=30): for k, v in lister.iteritems(): time.sleep(10) for val in v: ipvar = val ping_cmd = 'ping -D -c1 {0}'.format(ipvar) - while os.system(ping_cmd) != 0: - print '\nWaiting for machine\n' - time.sleep(10) + for i in range(attempts): + if os.system(ping_cmd) != 0: + print '\nWaiting for machine\n' + time.sleep(10) + else: + break print ('\n\n %s is UP \n\n ' % ipvar) @staticmethod diff --git a/func/spawn_vm.py b/func/spawn_vm.py index ec63230c..15c26861 100644 --- a/func/spawn_vm.py +++ b/func/spawn_vm.py @@ -26,7 +26,6 @@ class SpawnVM(Env_setup): installer = ''
def __init__(self, vm_info):
- Env_setup.__init__(self)
print 'SpawnVM Class initiated'
vm_role_ip_dict = vm_info.copy()
print 'Generating Heat Template\n'
diff --git a/requirements.txt b/requirements.txt index 358b7d0d..af07083d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,3 +7,6 @@ python-cinderclient==1.4.0 python-heatclient==0.6.0 python-keystoneclient==1.6.0 reportlab==3.0 +Flask==0.11.1 +Flask-RESTful==0.3.5 +flask-restful-swagger==0.19 diff --git a/restful_server/__init__.py b/restful_server/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/restful_server/__init__.py diff --git a/restful_server/db.py b/restful_server/db.py new file mode 100644 index 00000000..b8314de2 --- /dev/null +++ b/restful_server/db.py @@ -0,0 +1,48 @@ +############################################################################## +# 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 +############################################################################## +from datetime import datetime +import uuid + +jobs = {} + + +def create_job(args): + if len(filter(lambda x: jobs[x]['state'] == 'processing', jobs.keys())) > 0: + return None + else: + job = {'job_id': str(uuid.uuid4()), + 'installer_type': args["installer_type"], + 'installer_ip': args["installer_ip"], + 'pod_name': args["pod_name"], + 'suite_name': args["suite_name"], + 'deadline': args["deadline"], + 'type': args["type"], + 'start-time': str(datetime.now()), + 'end-time': None, + 'state': 'processing', + 'state_detail': [], + 'result': []} + jobs[job['job_id']] = job + return job['job_id'] + + +def delete_job(job_id): + if job_id in jobs.keys(): + jobs[job_id]['end_time'] = datetime.now() + jobs[job_id]['state'] = 'terminated' + return True + else: + return False + + +def get_job_info(job_id): + if job_id in jobs.keys(): + return jobs[job_id] + else: + return None diff --git a/restful_server/qtip_server.py b/restful_server/qtip_server.py new file mode 100644 index 00000000..59588363 --- /dev/null +++ b/restful_server/qtip_server.py @@ -0,0 +1,138 @@ +############################################################################## +# 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 +############################################################################## +from flask import Flask, abort +from flask_restful import Api, Resource, fields, reqparse +from flask_restful_swagger import swagger +import db + + +app = Flask(__name__) +api = swagger.docs(Api(app), apiVersion='0.1') + + +@swagger.model +class JobModel: + resource_fields = { + 'installer_type': fields.String, + 'installer_ip': fields.String, + 'deadline': fields.Integer, + 'pod_name': fields.String, + 'suite_name': fields.String, + 'type': fields.String + } + required = ['installer_type', 'install_ip'] + + +@swagger.model +class JobResponseModel: + resource_fields = { + 'job_id': fields.String + } + + +class Job(Resource): + @swagger.operation( + notes='get a job by ID', + nickname='get', + parameters=[], + responseMessages=[ + { + "code": 200, + "message": "Job detail info." + }, + { + "code": 404, + "message": "Can't not find the job id XXXXXXX" + } + ] + ) + def get(self, id): + ret = db.get_job_info(id) + return ret if ret else abort(404, " Can't not find the job id %s" % id) + + @swagger.operation( + notes='delete a job by ID', + nickname='delete', + parameters=[], + responseMessages=[ + { + "code": 200, + "message": "Delete successfully" + }, + { + "code": 404, + "message": "Can not find job_id XXXXXXXXX" + } + ] + ) + def delete(self, id): + ret = db.delete_job(id) + return {'result': "Delete successfully"} if ret else abort(404, "Can not find job_id %s" % id) + + +class JobList(Resource): + @swagger.operation( + note='create a job with parameters', + nickname='create', + parameters=[ + { + "name": "body", + "description": """ +"installer_type": The installer type, for example fuel, compass.., + +"installer_ip": The installer ip of the pod, + +"deadline": If specified, the maximum duration in minutes +for any single test iteration, default is '10', + +"pod_name": If specified, the Pod name, default is 'default', + +"suite_name": If specified, Test suite name, for example 'compute', 'network', 'storage', 'all', +default is 'all' +"type": BM or VM,default is 'BM' + """, + "required": True, + "type": "JobModel", + "paramType": "body" + } + ], + type=JobResponseModel.__name__, + responseMessages=[ + { + "code": 200, + "message": "Job submitted" + }, + { + "code": 400, + "message": "Missing configuration data" + }, + { + "code": 409, + "message": "It already has one job running now!" + } + ] + ) + def post(self): + parser = reqparse.RequestParser() + parser.add_argument('installer_type', type=str, required=True, help='Installer_type is required') + parser.add_argument('installer_ip', type=str, required=True, help='Installer_ip is required') + parser.add_argument('deadline', type=int, required=False, default=10, help='dealine should be integer') + parser.add_argument('pod_name', type=str, required=False, default='default', help='pod_name should be string') + parser.add_argument('suite_name', type=str, required=False, default='all', help='suite_name should be string') + parser.add_argument('type', type=str, required=False, default='BM', help='type should be BM, VM and ALL') + args = parser.parse_args() + ret = db.create_job(args) + return {'job_id': str(ret)} if ret else abort(409, 'message:It already has one job running now!') + + +api.add_resource(JobList, '/api/v1.0/jobs') +api.add_resource(Job, '/api/v1.0/jobs/<string:id>') + +if __name__ == "__main__": + app.run(debug=True) diff --git a/test_cases/zte-pod1/compute/dhrystone_bm.yaml b/test_cases/zte-pod1/compute/dhrystone_bm.yaml index 437dafd8..15a40d42 100644 --- a/test_cases/zte-pod1/compute/dhrystone_bm.yaml +++ b/test_cases/zte-pod1/compute/dhrystone_bm.yaml @@ -17,12 +17,6 @@ Context: Virtual_Machines: - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* - - Test_Description: Test_category: "Compute" diff --git a/test_cases/zte-pod1/compute/dhrystone_vm.yaml b/test_cases/zte-pod1/compute/dhrystone_vm.yaml index 6f213426..9e3f2113 100644 --- a/test_cases/zte-pod1/compute/dhrystone_vm.yaml +++ b/test_cases/zte-pod1/compute/dhrystone_vm.yaml @@ -20,11 +20,6 @@ Context: flavor: m1.large role: host - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* - Test_Description: Test_category: "Compute" Benchmark: "dhrystone" diff --git a/test_cases/zte-pod1/compute/dpi_bm.yaml b/test_cases/zte-pod1/compute/dpi_bm.yaml index d1c5963e..940307c3 100644 --- a/test_cases/zte-pod1/compute/dpi_bm.yaml +++ b/test_cases/zte-pod1/compute/dpi_bm.yaml @@ -14,10 +14,6 @@ Context: role: host Virtual_Machines: - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* Test_Description: Test_category: "Compute" diff --git a/test_cases/zte-pod1/compute/dpi_vm.yaml b/test_cases/zte-pod1/compute/dpi_vm.yaml index d47b7f31..e61bf79f 100644 --- a/test_cases/zte-pod1/compute/dpi_vm.yaml +++ b/test_cases/zte-pod1/compute/dpi_vm.yaml @@ -20,11 +20,6 @@ Context: role: 1Run flavor: m1.large - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* - Test_Description: Test_category: "Compute" Benchmark: "dpi" diff --git a/test_cases/zte-pod1/compute/ramspeed_bm.yaml b/test_cases/zte-pod1/compute/ramspeed_bm.yaml index d9e1f170..f126a19d 100644 --- a/test_cases/zte-pod1/compute/ramspeed_bm.yaml +++ b/test_cases/zte-pod1/compute/ramspeed_bm.yaml @@ -17,10 +17,6 @@ Context: Virtual_Machines: - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* Test_Description: diff --git a/test_cases/zte-pod1/compute/ramspeed_vm.yaml b/test_cases/zte-pod1/compute/ramspeed_vm.yaml index 942aa3fe..7a2ef849 100644 --- a/test_cases/zte-pod1/compute/ramspeed_vm.yaml +++ b/test_cases/zte-pod1/compute/ramspeed_vm.yaml @@ -20,10 +20,6 @@ Context: flavor: m1.large role: host - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* Test_Description: Test_category: "Compute" diff --git a/test_cases/zte-pod1/compute/ssl_bm.yaml b/test_cases/zte-pod1/compute/ssl_bm.yaml index e4f608e6..95d53840 100644 --- a/test_cases/zte-pod1/compute/ssl_bm.yaml +++ b/test_cases/zte-pod1/compute/ssl_bm.yaml @@ -14,12 +14,6 @@ Context: role: host Virtual_Machines: - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* - - Test_Description: Test_category: "Compute" Benchmark: "ssl" diff --git a/test_cases/zte-pod1/compute/ssl_vm.yaml b/test_cases/zte-pod1/compute/ssl_vm.yaml index cc97ecfd..60045903 100644 --- a/test_cases/zte-pod1/compute/ssl_vm.yaml +++ b/test_cases/zte-pod1/compute/ssl_vm.yaml @@ -19,10 +19,6 @@ Context: flavor: 'm1.large' role: host - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* Test_Description: Test_category: "Compute" diff --git a/test_cases/zte-pod1/compute/whetstone_bm.yaml b/test_cases/zte-pod1/compute/whetstone_bm.yaml index 6c703de1..bf14ea3a 100644 --- a/test_cases/zte-pod1/compute/whetstone_bm.yaml +++ b/test_cases/zte-pod1/compute/whetstone_bm.yaml @@ -16,12 +16,6 @@ Context: role: host Virtual_Machines: - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* - - Test_Description: Test_category: "Compute" Benchmark: "whetstone" diff --git a/test_cases/zte-pod1/compute/whetstone_vm.yaml b/test_cases/zte-pod1/compute/whetstone_vm.yaml index bcde58c1..9f12597f 100644 --- a/test_cases/zte-pod1/compute/whetstone_vm.yaml +++ b/test_cases/zte-pod1/compute/whetstone_vm.yaml @@ -20,10 +20,6 @@ Context: flavor: m1.large role: host - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* Test_Description: Test_category: "Compute" diff --git a/test_cases/zte-pod1/network/iperf_bm.yaml b/test_cases/zte-pod1/network/iperf_bm.yaml index 5b2126fd..e022d4a4 100644 --- a/test_cases/zte-pod1/network/iperf_bm.yaml +++ b/test_cases/zte-pod1/network/iperf_bm.yaml @@ -21,11 +21,6 @@ Context: Virtual_Machines: - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* - Test_Description: Test_category: "network" Benchmark: "iperf" diff --git a/test_cases/zte-pod1/network/iperf_vm.yaml b/test_cases/zte-pod1/network/iperf_vm.yaml index f03b5b6f..57e09e02 100644 --- a/test_cases/zte-pod1/network/iperf_vm.yaml +++ b/test_cases/zte-pod1/network/iperf_vm.yaml @@ -27,11 +27,6 @@ Context: role: 2-host flavor: m1.large - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* - Test_Description: Test_category: "network" Benchmark: "iperf" diff --git a/test_cases/zte-pod1/network/iperf_vm_2.yaml b/test_cases/zte-pod1/network/iperf_vm_2.yaml index 649adf8c..c3cd6b35 100644 --- a/test_cases/zte-pod1/network/iperf_vm_2.yaml +++ b/test_cases/zte-pod1/network/iperf_vm_2.yaml @@ -28,10 +28,6 @@ Context: role: 2-host flavor: m1.large - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* Test_Description: Test_category: "network" diff --git a/test_cases/zte-pod1/storage/fio_bm.yaml b/test_cases/zte-pod1/storage/fio_bm.yaml index d07623c5..e940e9ba 100644 --- a/test_cases/zte-pod1/storage/fio_bm.yaml +++ b/test_cases/zte-pod1/storage/fio_bm.yaml @@ -17,10 +17,6 @@ Context: Virtual_Machines: - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* Test_Description: diff --git a/test_cases/zte-pod1/storage/fio_vm.yaml b/test_cases/zte-pod1/storage/fio_vm.yaml index 3e2f9174..65a1e67b 100644 --- a/test_cases/zte-pod1/storage/fio_vm.yaml +++ b/test_cases/zte-pod1/storage/fio_vm.yaml @@ -20,10 +20,6 @@ Context: flavor: m1.large role: host - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* Test_Description: Test_category: "Storage" diff --git a/tests/cli_test.py b/tests/cli_test.py index f12e8fed..bd31d987 100644 --- a/tests/cli_test.py +++ b/tests/cli_test.py @@ -16,5 +16,5 @@ class TestClass: def test_cli_error(self, capfd, test_input, expected): with pytest.raises(SystemExit): cli(test_input) - resout, reserr = capfd.readouterr() - assert expected in resout + resout, reserr = capfd.readouterr() + assert expected in resout diff --git a/tests/qtip_server_test.py b/tests/qtip_server_test.py new file mode 100644 index 00000000..31aa96dc --- /dev/null +++ b/tests/qtip_server_test.py @@ -0,0 +1,78 @@ +import restful_server.qtip_server as server +import pytest +import json + + +@pytest.fixture +def app(): + return server.app + + +@pytest.fixture +def app_client(app): + client = app.test_client() + return client + + +class TestClass: + @pytest.mark.parametrize("body, expected", [ + ({'installer_type': 'fuel', + 'installer_ip': '10.20.0.2'}, + {'job_id': '', + 'installer_type': 'fuel', + 'installer_ip': '10.20.0.2', + 'pod_name': 'default', + 'suite_name': 'all', + 'deadline': 10, + 'type': 'BM', + 'state': 'processing', + 'state_detail': [], + 'result': []}), + ({'installer_type': 'fuel', + 'installer_ip': '10.20.0.2', + 'pod_name': 'zte-pod1', + 'deadline': 20, + 'suite_name': 'compute', + 'type': 'VM'}, + {'job_id': '', + 'installer_type': 'fuel', + 'installer_ip': '10.20.0.2', + 'pod_name': 'zte-pod1', + 'suite_name': 'compute', + 'deadline': 20, + 'type': 'VM', + 'state': 'processing', + 'state_detail': [], + 'result': []}) + ]) + def test_post_get_delete_job_successful(self, app_client, body, expected): + reply = app_client.post("/api/v1.0/jobs", data=body) + print reply.data + id = json.loads(reply.data)['job_id'] + expected['job_id'] = id + get_reply = app_client.get("/api/v1.0/jobs/%s" % id) + reply_data = json.loads(get_reply.data) + assert len(filter(lambda x: reply_data[x] == expected[x], expected.keys())) == len(expected) + delete_reply = app_client.delete("/api/v1.0/jobs/%s" % id) + assert "successful" in delete_reply.data + + @pytest.mark.parametrize("body, expected", [ + ([{'installer_type': 'fuel', + 'installer_ip': '10.20.0.2'}, + {'installer_type': 'compass', + 'installer_ip': '192.168.20.50'}], + ['job_id', + 'It already has one job running now!']), + ([{'installer_type': 'fuel', + 'installer_ip': '10.20.0.2'}, + {'installer_type': 'compass', + 'insta_ip': '192.168.20.50'}], + ['job_id', + 'Installer_ip is required']) + ]) + def test_post_two_jobs_unsuccessful(self, app_client, body, expected): + reply_1 = app_client.post("/api/v1.0/jobs", data=body[0]) + reply_2 = app_client.post("/api/v1.0/jobs", data=body[1]) + assert expected[0] in json.loads(reply_1.data).keys() + app_client.delete("/api/v1.0/jobs/%s" % json.loads(reply_1.data)['job_id']) + assert expected[1] in json.dumps(reply_2.data) |