Avishek Duta | dd80833 | 2018-09-20 13:27:10 -0500 | [diff] [blame] | 1 | Tempest Integration of Tungsten Fabric (Contrail) |
| 2 | ================================================= |
| 3 | |
| 4 | This directory contains Tempest tests to cover the contrail project, as well |
| 5 | as a plugin to automatically load these tests into tempest. This is a set of |
| 6 | integration tests to be run against a live open-contrail cluster. Tempest has |
| 7 | test-cases for Contrail API validation, scenarios, and other specific tests |
| 8 | useful in validating an open-contrail deployment. |
| 9 | |
| 10 | See the tempest plugin docs for information on using it: |
| 11 | |
| 12 | [http://docs.openstack.org/developer/tempest/plugin.html#using-plugins](http://docs.openstack.org/developer/tempest/plugin.html#using-plugins) |
| 13 | |
| 14 | See the tempest docs for information on writing new tests etc: |
| 15 | |
| 16 | [http://docs.openstack.org/developer/tempest/](http://docs.openstack.org/developer/tempest/) |
| 17 | |
| 18 | |
| 19 | Quickstart |
| 20 | ---------- |
| 21 | |
| 22 | #Tempest Installation |
| 23 | |
| 24 | To run *tungsten-tempest*, you must first have `Tempest`_ installed and configured |
| 25 | properly. Please reference Tempest's `Quickstart`_ guide to do so and for all |
| 26 | exact details. Follow all the steps outlined therein. |
| 27 | |
| 28 | Here are some sample steps: |
| 29 | |
| 30 | $ git clone https://git.openstack.org/openstack/tempest |
| 31 | $ cd tempest |
| 32 | $ pip install -r requirements.txt |
| 33 | $ pip install -r test-requirements.txt |
| 34 | $ pip install tox |
| 35 | $ pip install tempest |
| 36 | |
| 37 | Now below command should show you list of available tempest test cases. |
| 38 | |
| 39 | $ ostestr -l |
| 40 | |
| 41 | You can install all these including tempest in a virtual |
| 42 | environment. If virtual environment is not installed, then install it using |
| 43 | "`sudo apt-get install python-virtualenv`". Afterward, proceed with the steps below. |
| 44 | |
| 45 | #Patrole Installation |
| 46 | |
| 47 | This is done with pip after you check out the [Patrole repo](https://github.com/openstack/patrole "Patrole repo"). Please reference `Patrole` [Quickstart](https://github.com/openstack/patrole/blob/master/README.rst "Quickstart") guide for further details. |
| 48 | |
| 49 | Here are some sample steps: |
| 50 | |
| 51 | $ git clone https://git.openstack.org/openstack/patrole |
| 52 | $ cd patrole |
| 53 | $ pip install -e . |
| 54 | |
| 55 | NOTE: This can be done within a venv. |
| 56 | Now below command should show you list of available Patrole test cases. |
| 57 | |
| 58 | $ ostestr -l | grep patrole |
| 59 | |
| 60 | #Tungsten-tempest Installation |
| 61 | |
| 62 | This is done with pip after you check out the tungsten-tempest repo:: |
| 63 | |
| 64 | $ git clone https://git.openstack.org/tungsten/tungsten-tempest |
| 65 | $ pip install -e tungsten_tempest/ |
| 66 | |
| 67 | NOTE: This can be done within a venv. |
| 68 | Now below command should show you list of available tungsten-tempest test cases. |
| 69 | |
| 70 | $ ostestr -l | grep tungsten |
| 71 | |
| 72 | #Configuration |
| 73 | |
| 74 | You must properly configure tempest, which is relatively straightforward. For details on configuring tempest refer to the [tempest-configuration](https://github.com/openstack/tempest/blob/master/doc/source/configuration.rst "tempest-configuration"). |
| 75 | |
| 76 | Next you must properly configure Patrole, which is relatively straightforward. For details on configuring Patrole refer to the [patrole-configuration](https://github.com/openstack/patrole/blob/master/doc/source/configuration.rst "patrole-configuration") |
| 77 | |
| 78 | Next you must properly configure tungsten-fabric, which is relatively straightforward too. For details on configuring tungsten-fabric refer to the :ref:`tungsten-configuration`. |
| 79 | |
| 80 | After comfiguring tempmest.conf as per tempest and Patrole requirements, please make below changes too in the patrole section of tempest.conf: |
| 81 | |
| 82 | enable_rbac must be true. |
| 83 | |
| 84 | test_custom_requirements must be true if you want to run tests against a `custom_requirements_file` which defines RBAC requirements. |
| 85 | |
| 86 | custom_requirements_file must be absolute path of file path of the YAML file that defines your RBAC requirements. |
| 87 | |
| 88 | For the details about these flags please refer [patrole.conf.sample](https://github.com/openstack/patrole/blob/master/etc/patrole.conf.sample "patrole.conf.sample") file. |
| 89 | |
| 90 | |
| 91 | **NOTE:** Make sure you have contrail endpoints in keystone catalog-list already like sdn-l-config-*. Otherwise configure below two keys under [sdn] section of tempest.conf. |
| 92 | |
| 93 | [sdn] |
| 94 | endpoint_type = <public|admin|internal|publicURL|adminURL|internalURL> |
| 95 | catalog_type = <Catalog type of the SDN service, default sdn-l-config> |
| 96 | |
| 97 | #Running tungsten-tempest |
| 98 | |
| 99 | Once the configuration is done you're now ready to run tungsten-fabric. |
| 100 | |
| 101 | The easiest way to run is using any testr utilities like below: |
| 102 | |
| 103 | $ ostestr run --regex tungsten_tempest_plugin.tests.api |
| 104 | |
| 105 | This can also be done using the `tempest_run`_ command. This can be done by running:: |
| 106 | |
| 107 | $ tempest run --regex '^tungsten_tempest_plugin\.tests\.api' |
| 108 | |
| 109 | There is also the option to use testr directly, or any `testr`_ based test runner, like `ostestr`_. For example, from the work-space dir run:: |
| 110 | |
| 111 | $ stestr --regex '(?!.*\[.*\bslow\b.*\])(^tungsten_tempest_plugin\.tests\.api))' |
| 112 | |
| 113 | will run the same set of tests as the default gate jobs. |
| 114 | |
| 115 | You can also run tungsten_tempest tests using `tox`_. To do so, ``cd`` into the **Tempest** directory and run:: |
| 116 | |
| 117 | $ tox -eall-plugin -- tungstent_tempest_plugin.tests.api |
| 118 | |
| 119 | #Log Information |
| 120 | |
| 121 | Log information from tests is captured in ``tempest.log`` under the Tempest repository. Some Patrole debugging information is captured in that log related to expected test results and :ref:`role-overriding`. |
| 122 | |
| 123 | More detailed RBAC testing log output is emitted to ``tungsten_log``. |
| 124 | |
| 125 | To configure tungsten-tempest's logging, see the :ref:`tungsten-tempest-configuration` guide. |
| 126 | |
| 127 | |
| 128 | Tempest: [https://github.com/openstack/tempest](https://github.com/openstack/tempest) |
| 129 | |
| 130 | Tempest Quickstart: [https://docs.openstack.org/tempest/latest/overview.html#quickstart](https://docs.openstack.org/tempest/latest/overview.html#quickstart) |
| 131 | |
| 132 | tempest_run: [https://docs.openstack.org/tempest/latest/run.html](https://docs.openstack.org/tempest/latest/run.html) |
| 133 | |
| 134 | testr: [https://testrepository.readthedocs.org/en/latest/MANUAL.html |
| 135 | ](https://testrepository.readthedocs.org/en/latest/MANUAL.html) |
| 136 | |
| 137 | ostestr: [https://docs.openstack.org/os-testr/latest/](https://docs.openstack.org/os-testr/latest/) |
| 138 | |
| 139 | tox: [https://tox.readthedocs.io/en/latest/](https://tox.readthedocs.io/en/latest/) |
| 140 | |
| 141 | |
| 142 | |
| 143 | #RBAC Tests |
| 144 | ---------- |
| 145 | |
| 146 | To change the role that the tungsten_tempest tests are being run as, edit ``rbac_test_role`` in the ``patrole`` section of tempest.conf: :: |
| 147 | |
| 148 | [patrole] |
| 149 | rbac_test_role = member |
| 150 | ... |
| 151 | |
| 152 | **NOTE**:: |
| 153 | |
| 154 | The ``rbac_test_role`` is service-specific. member, for example, is an arbitrary role, but by convention is used to designate the default non-admin role in the system. Most tunsgtent_tempest tests should be run with **admin** and **member** roles. However, other services may use entirely different roles. |
| 155 | |
| 156 | For more information about the member role and its nomenclature, |
| 157 | |
| 158 | please see: `<https://ask.openstack.org/en/question/4759/member-vs-_member_/>`__. |
| 159 | |