Merge pull request #14 from Goutham-Pratapa/master
Add tests for Policy-Management and BGPVPN.
diff --git a/README.md b/README.md
index c3775b1..4bae9e6 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,8 @@
[![Travis-CI](https://travis-ci.com/tungstenfabric/tungsten-tempest.svg?branch=master)](https://travis-ci.com/tungstenfabric/tungsten-tempest)
-Tempest Integration of Tungsten Fabric (Contrail)
-=================================================
+# Tempest Integration of Tungsten Fabric (Contrail)
-This directory contains Tempest tests to cover the contrail project, as well
-as a plugin to automatically load these tests into tempest. This is a set of
-integration tests to be run against a live open-contrail cluster. Tempest has
-test-cases for Contrail API validation, scenarios, and other specific tests
-useful in validating an open-contrail deployment.
+This directory contains Tempest tests to cover the contrail project, as well as a plugin to automatically load these tests into tempest. This is a set of integration tests to be run against a live open-contrail cluster. Tempest has test-cases for Contrail API validation, scenarios, and other specific tests useful in validating an open-contrail deployment.
See the tempest plugin docs for information on using it:
@@ -18,14 +13,11 @@
[http://docs.openstack.org/developer/tempest/](http://docs.openstack.org/developer/tempest/)
-Quickstart
-----------
+## Quickstart
-#Tempest Installation
+### Tempest Installation
-To run *tungsten-tempest*, you must first have `Tempest`_ installed and configured
-properly. Please reference Tempest's `Quickstart`_ guide to do so and for all
-exact details. Follow all the steps outlined therein.
+To run *tungsten-tempest*, you must first have [Tempest](https://docs.openstack.org/tempest) installed and configured properly. Please reference Tempest's [Quickstart](https://docs.openstack.org/tempest/latest/overview.html#quickstart) guide to do so and for all exact details. Follow all the steps outlined therein.
Here are some sample steps:
@@ -40,13 +32,11 @@
$ ostestr -l
-You can install all these including tempest in a virtual
-environment. If virtual environment is not installed, then install it using
-"`sudo apt-get install python-virtualenv`". Afterward, proceed with the steps below.
+You can install all these including tempest in a virtual environment. If virtual environment is not installed, then install it using "`sudo apt-get install python-virtualenv`". Afterward, proceed with the steps below.
-#Patrole Installation
+### Patrole Installation
-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.
+This is done with pip after you check out the [Patrole repo](https://github.com/openstack/patrole "Patrole repo"). Please reference `Patrole` [Quickstart](https://docs.openstack.org/patrole/latest/overview.html?highlight=quickstart#quickstart) guide for further details.
Here are some sample steps:
@@ -59,11 +49,11 @@
$ ostestr -l | grep patrole
-#Tungsten-tempest Installation
+### Tungsten-tempest Installation
-This is done with pip after you check out the tungsten-tempest repo::
+This is done with pip after you check out the tungsten-tempest repo:
- $ git clone https://git.openstack.org/tungsten/tungsten-tempest
+ $ git clone https://github.com/tungstenfabric/tungsten-tempest
$ pip install -e tungsten_tempest/
NOTE: This can be done within a venv.
@@ -71,13 +61,13 @@
$ ostestr -l | grep tungsten
-#Configuration
+### Configuration
-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").
+You must properly configure tempest, which is relatively straightforward. For details on configuring tempest refer to the [tempest-configuration](https://docs.openstack.org/tempest/latest/configuration.html).
-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")
+Next you must properly configure Patrole, which is relatively straightforward. For details on configuring Patrole refer to the [patrole-configuration](https://docs.openstack.org/patrole/latest/configuration.html)
-Next you must properly configure tungsten-fabric, which is relatively straightforward too. For details on configuring tungsten-fabric refer to the :ref:`tungsten-configuration`.
+Next you must properly configure tungsten-fabric, which is relatively straightforward too. For details on configuring tungsten-fabric refer to the [tungsten-configuration](https://github.com/tungstenfabric/tungsten-tempest/blob/master/doc/source/configuration.rst).
After comfiguring tempmest.conf as per tempest and Patrole requirements, please make below changes too in the patrole section of tempest.conf:
@@ -87,7 +77,7 @@
custom_requirements_file must be absolute path of file path of the YAML file that defines your RBAC requirements.
-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.
+For the details about these flags please refer [patrole.conf.sample](https://docs.openstack.org/patrole/latest/configuration.html#sample-configuration-file) file.
**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.
@@ -96,7 +86,7 @@
endpoint_type = <public|admin|internal|publicURL|adminURL|internalURL>
catalog_type = <Catalog type of the SDN service, default sdn-l-config>
-#Running tungsten-tempest
+### Running tungsten-tempest
Once the configuration is done you're now ready to run tungsten-fabric.
@@ -104,58 +94,42 @@
$ ostestr run --regex tungsten_tempest_plugin.tests.api
-This can also be done using the `tempest_run`_ command. This can be done by running::
+This can also be done using the [tempest_run](https://docs.openstack.org/tempest/latest/run.html) command. This can be done by running:
$ tempest run --regex '^tungsten_tempest_plugin\.tests\.api'
-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::
+There is also the option to use testr directly, or any [testr](https://testrepository.readthedocs.org/en/latest/MANUAL.html) based test runner, like [ostestr](https://docs.openstack.org/os-testr/latest/). For example, from the work-space dir run:
$ stestr --regex '(?!.*\[.*\bslow\b.*\])(^tungsten_tempest_plugin\.tests\.api))'
will run the same set of tests as the default gate jobs.
-You can also run tungsten_tempest tests using `tox`_. To do so, ``cd`` into the **Tempest** directory and run::
+You can also run tungsten_tempest tests using [tox](https://tox.readthedocs.io/en/latest/). To do so, ``cd`` into the **Tempest** directory and run:
$ tox -eall-plugin -- tungstent_tempest_plugin.tests.api
-#Log Information
+### Log Information
-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`.
+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 [role-overriding](https://docs.openstack.org/patrole/latest/test_writing_guide.html?highlight=role%20overriding#role-overriding).
More detailed RBAC testing log output is emitted to ``tungsten_log``.
-To configure tungsten-tempest's logging, see the :ref:`tungsten-tempest-configuration` guide.
+To configure tungsten-tempest's logging, see the [tungsten-tempest-configuration](https://github.com/tungstenfabric/tungsten-tempest/blob/master/doc/source/configuration.rst) guide.
-Tempest: [https://github.com/openstack/tempest](https://github.com/openstack/tempest)
+## RBAC Tests
-Tempest Quickstart: [https://docs.openstack.org/tempest/latest/overview.html#quickstart](https://docs.openstack.org/tempest/latest/overview.html#quickstart)
-
-tempest_run: [https://docs.openstack.org/tempest/latest/run.html](https://docs.openstack.org/tempest/latest/run.html)
-
-testr: [https://testrepository.readthedocs.org/en/latest/MANUAL.html
-](https://testrepository.readthedocs.org/en/latest/MANUAL.html)
-
-ostestr: [https://docs.openstack.org/os-testr/latest/](https://docs.openstack.org/os-testr/latest/)
-
-tox: [https://tox.readthedocs.io/en/latest/](https://tox.readthedocs.io/en/latest/)
-
-
-
-#RBAC Tests
-----------
-
-To change the role that the tungsten_tempest tests are being run as, edit ``rbac_test_role`` in the ``patrole`` section of tempest.conf: ::
+To change the role that the tungsten_tempest tests are being run as, edit ``rbac_test_role`` in the ``patrole`` section of tempest.conf:
[patrole]
rbac_test_role = member
...
-**NOTE**::
+**NOTE**:
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.
For more information about the member role and its nomenclature,
-please see: `<https://ask.openstack.org/en/question/4759/member-vs-_member_/>`__.
+please see: [https://ask.openstack.org/en/question/4759/member-vs-_member_/](https://ask.openstack.org/en/question/4759/member-vs-_member_/).
diff --git a/tungsten_tempest_plugin/tests/api/contrail/rbac_base.py b/tungsten_tempest_plugin/tests/api/contrail/rbac_base.py
index 7da4633..527eb97 100644
--- a/tungsten_tempest_plugin/tests/api/contrail/rbac_base.py
+++ b/tungsten_tempest_plugin/tests/api/contrail/rbac_base.py
@@ -100,10 +100,22 @@
LOG = logging.getLogger(__name__)
+def get_contail_version():
+ return float(CONF.sdn.contrail_version)
+
+
class BaseContrailTest(rbac_utils.RbacUtilsMixin, test.BaseTestCase):
"""Base class for Contrail tests."""
credentials = ['primary', 'admin']
+ required_contrail_version = None
+
+ @classmethod
+ def skip_if_contrail_version_less(cls, version):
+ if get_contail_version() < version:
+ msg = "The tests require Contrail >= %s" % version
+ raise cls.skipException(msg)
+
@classmethod
def skip_checks(cls):
super(BaseContrailTest, cls).skip_checks()
@@ -115,6 +127,8 @@
if CONF.auth.tempest_roles != ['admin']:
raise cls.skipException(
"%s skipped because tempest roles is not admin" % cls.__name__)
+ if cls.required_contrail_version:
+ cls.skip_if_contrail_version_less(cls.required_contrail_version)
@classmethod
def setup_clients(cls):
diff --git a/tungsten_tempest_plugin/tests/api/contrail/test_config_client.py b/tungsten_tempest_plugin/tests/api/contrail/test_config_client.py
index 213bd47..3469064 100644
--- a/tungsten_tempest_plugin/tests/api/contrail/test_config_client.py
+++ b/tungsten_tempest_plugin/tests/api/contrail/test_config_client.py
@@ -45,7 +45,7 @@
def _create_config_node(self):
config_node_ip_address = self._random_ip_generator()
display_name = data_utils.rand_name('config_node')
- if float(CONF.sdn.contrail_version) < 5:
+ if rbac_base.get_contail_version() < 5:
fq_name = [display_name]
else:
fq_name = ['default-global-system-config', display_name]
@@ -200,7 +200,7 @@
with self.rbac_utils.override_role(self):
self.config_client.list_global_system_configs()
- @testtools.skipUnless(float(CONF.sdn.contrail_version) < 5,
+ @testtools.skipUnless(rbac_base.get_contail_version() < 5,
'Not supported in OpenContrail versions >= 5')
@rbac_rule_validation.action(service="Contrail",
rules=["create_global_system_configs"])
@@ -214,7 +214,7 @@
rules=["show_global_system_config"])
@decorators.idempotent_id('4b9f9131-cb34-4b7d-9d06-c6aca85cce3a')
def test_show_global_system_config(self):
- if float(CONF.sdn.contrail_version) < 5:
+ if rbac_base.get_contail_version() < 5:
new_config = self._create_global_system_config()
with self.rbac_utils.override_role(self):
self.config_client.show_global_system_config(
@@ -236,7 +236,7 @@
self.config_client.show_global_system_config(
gsc['uuid'])
- @testtools.skipUnless(float(CONF.sdn.contrail_version) < 5,
+ @testtools.skipUnless(rbac_base.get_contail_version() < 5,
'Not supported in OpenContrail versions >= 5')
@rbac_rule_validation.action(service="Contrail",
rules=["update_global_system_config"])
@@ -250,7 +250,7 @@
new_config['uuid'],
display_name=update_name)
- @testtools.skipUnless(float(CONF.sdn.contrail_version) < 5,
+ @testtools.skipUnless(rbac_base.get_contail_version() < 5,
'Not supported in OpenContrail versions >= 5')
@rbac_rule_validation.action(service="Contrail",
rules=["delete_global_system_config"])
diff --git a/tungsten_tempest_plugin/tests/api/contrail/test_fabric.py b/tungsten_tempest_plugin/tests/api/contrail/test_fabric.py
index e100d59..74f22d8 100644
--- a/tungsten_tempest_plugin/tests/api/contrail/test_fabric.py
+++ b/tungsten_tempest_plugin/tests/api/contrail/test_fabric.py
@@ -25,11 +25,7 @@
class FabricContrailTest(rbac_base.BaseContrailTest):
- @classmethod
- def skip_checks(cls):
- super(FabricContrailTest, cls).skip_checks()
- if float(CONF.sdn.contrail_version) < 5:
- raise cls.skipException("fabric requires Contrail >= 5")
+ required_contrail_version = 5
@classmethod
def resource_setup(cls):
diff --git a/tungsten_tempest_plugin/tests/api/contrail/test_fabric_namespaces.py b/tungsten_tempest_plugin/tests/api/contrail/test_fabric_namespaces.py
index 21f8316..7b173c8 100644
--- a/tungsten_tempest_plugin/tests/api/contrail/test_fabric_namespaces.py
+++ b/tungsten_tempest_plugin/tests/api/contrail/test_fabric_namespaces.py
@@ -25,11 +25,7 @@
class FabricNamespacesContrailTest(rbac_base.BaseContrailTest):
- @classmethod
- def skip_checks(cls):
- super(FabricNamespacesContrailTest, cls).skip_checks()
- if float(CONF.sdn.contrail_version) < 5:
- raise cls.skipException("fabric-namespace requires Contrail >= 5")
+ required_contrail_version = 5
@classmethod
def resource_setup(cls):
diff --git a/tungsten_tempest_plugin/tests/api/contrail/test_qos_queue.py b/tungsten_tempest_plugin/tests/api/contrail/test_qos_queue.py
index 8d6f77c..3224208 100644
--- a/tungsten_tempest_plugin/tests/api/contrail/test_qos_queue.py
+++ b/tungsten_tempest_plugin/tests/api/contrail/test_qos_queue.py
@@ -37,7 +37,7 @@
def _create_qos_queues(self):
name = data_utils.rand_name('test-rbac-qos-queue')
- if float(CONF.sdn.contrail_version) < 5:
+ if rbac_base.get_contail_version() < 5:
fq_name = [name]
else:
fq_name = ['default-global-system-config',