Add possibility to disable running stadium projects tests

This patch adds possibility to disable running of tests related to:
* networking-bgpvpn,
* neutron-fwaas,
* networking-sfc

which were moved to neutron-tempest-plugin repo recently.
This will be useful when tests will be run for one of
stable branches up to Stein, in which those tests are still
in project's repo.

Change-Id: I61dc252920154e7e0998eb2c7c1f026814796cdf
diff --git a/neutron_tempest_plugin/bgpvpn/base.py b/neutron_tempest_plugin/bgpvpn/base.py
index aeecbfc..b436a5d 100644
--- a/neutron_tempest_plugin/bgpvpn/base.py
+++ b/neutron_tempest_plugin/bgpvpn/base.py
@@ -72,8 +72,13 @@
     @classmethod
     def skip_checks(cls):
         super(BaseBgpvpnTest, cls).skip_checks()
+        msg = None
         if not utils.is_extension_enabled('bgpvpn', 'network'):
             msg = "Bgpvpn extension not enabled."
+        elif not CONF.bgpvpn.run_bgpvpn_tests:
+            msg = ("Running of bgpvpn related tests is disabled in "
+                   "plugin configuration.")
+        if msg:
             raise cls.skipException(msg)
 
     def create_bgpvpn(self, client, **kwargs):
diff --git a/neutron_tempest_plugin/config.py b/neutron_tempest_plugin/config.py
index e07c92a..7581f3c 100644
--- a/neutron_tempest_plugin/config.py
+++ b/neutron_tempest_plugin/config.py
@@ -116,7 +116,16 @@
 for opt in NeutronPluginOptions:
     CONF.register_opt(opt, 'neutron_plugin_options')
 
+# TODO(slaweq): This config option is added to avoid running bgpvpn tests twice
+# on stable branches till stable/stein. We need to remove this config option
+# once stable/stein is EOL. Bgpvpn tempest plugin has been merged into
+# neutron-tempest-plugin from Train. Train onwards bgpvpn tests will run from
+# neutron-tempest-plugins.
 BgpvpnGroup = [
+    cfg.BoolOpt('run_bgpvpn_tests',
+                default=True,
+                help=("If it is set to False bgpvpn api and scenario tests "
+                      "will be skipped")),
     cfg.IntOpt('min_asn',
                default=100,
                help=("Minimum number for the range of "
@@ -140,6 +149,39 @@
 CONF.register_group(bgpvpn_group)
 CONF.register_opts(BgpvpnGroup, group="bgpvpn")
 
+# TODO(slaweq): This config option is added to avoid running fwaas tests twice
+# on stable branches till stable/stein. We need to remove this config option
+# once stable/stein is EOL. Fwaas tempest plugin has been merged into
+# neutron-tempest-plugin from Train. Train onwards fwaas tests will run from
+# neutron-tempest-plugins.
+FwaasGroup = [
+    cfg.BoolOpt('run_fwaas_tests',
+                default=True,
+                help=("If it is set to False fwaas api and scenario tests "
+                      "will be skipped")),
+]
+
+fwaas_group = cfg.OptGroup(
+    name="fwaas", title=("Neutron-fwaas Service Options"))
+CONF.register_group(fwaas_group)
+CONF.register_opts(FwaasGroup, group="fwaas")
+
+# TODO(slaweq): This config option is added to avoid running SFC tests twice
+# on stable branches till stable/stein. We need to remove this config option
+# once stable/stein is EOL. SFC tempest plugin has been merged into
+# neutron-tempest-plugin from Train. Train onwards SFC tests will run from
+# neutron-tempest-plugins.
+SfcGroup = [
+    cfg.BoolOpt('run_sfc_tests',
+                default=True,
+                help=("If it is set to False SFC api and scenario tests "
+                      "will be skipped")),
+]
+
+sfc_group = cfg.OptGroup(name="sfc", title=("Networking-sfc Service Options"))
+CONF.register_group(sfc_group)
+CONF.register_opts(SfcGroup, group="sfc")
+
 config_opts_translator = {
     'project_network_cidr': 'tenant_network_cidr',
     'project_network_v6_cidr': 'tenant_network_v6_cidr',
diff --git a/neutron_tempest_plugin/fwaas/api/fwaas_v2_base.py b/neutron_tempest_plugin/fwaas/api/fwaas_v2_base.py
index 7a39978..f4f63ec 100644
--- a/neutron_tempest_plugin/fwaas/api/fwaas_v2_base.py
+++ b/neutron_tempest_plugin/fwaas/api/fwaas_v2_base.py
@@ -13,9 +13,21 @@
 #    under the License.
 
 from tempest.api.network import base
+from tempest import config
 
 from neutron_tempest_plugin.fwaas.common import fwaas_v2_client
 
+CONF = config.CONF
+
 
 class BaseFWaaSTest(fwaas_v2_client.FWaaSClientMixin, base.BaseNetworkTest):
-    pass
+
+    @classmethod
+    def skip_checks(cls):
+        super(BaseFWaaSTest, cls).skip_checks()
+        msg = None
+        if not CONF.fwaas.run_fwaas_tests:
+            msg = ("Running of fwaas related tests is disabled in "
+                   "plugin configuration.")
+        if msg:
+            raise cls.skipException(msg)
diff --git a/neutron_tempest_plugin/fwaas/scenario/fwaas_v2_manager.py b/neutron_tempest_plugin/fwaas/scenario/fwaas_v2_manager.py
index 01ca8c5..5ead2a7 100644
--- a/neutron_tempest_plugin/fwaas/scenario/fwaas_v2_manager.py
+++ b/neutron_tempest_plugin/fwaas/scenario/fwaas_v2_manager.py
@@ -41,6 +41,16 @@
     credentials = ['primary']
 
     @classmethod
+    def skip_checks(cls):
+        super(ScenarioTest, cls).skip_checks()
+        msg = None
+        if not CONF.fwaas.run_fwaas_tests:
+            msg = ("Running of fwaas related tests is disabled in "
+                   "plugin configuration.")
+        if msg:
+            raise cls.skipException(msg)
+
+    @classmethod
     def setup_clients(cls):
         super(ScenarioTest, cls).setup_clients()
         # Clients (in alphabetical order)
diff --git a/neutron_tempest_plugin/sfc/tests/api/base.py b/neutron_tempest_plugin/sfc/tests/api/base.py
index 732e2dc..606aed6 100644
--- a/neutron_tempest_plugin/sfc/tests/api/base.py
+++ b/neutron_tempest_plugin/sfc/tests/api/base.py
@@ -18,17 +18,31 @@
 import netaddr
 from tempest.api.network import base
 from tempest.common import utils
+from tempest import config
 from tempest.lib.common.utils import data_utils
 from tempest.lib import exceptions as lib_exc
 
 from neutron_tempest_plugin.sfc.tests import flowclassifier_client
 from neutron_tempest_plugin.sfc.tests import sfc_client
 
+CONF = config.CONF
+
 
 class BaseFlowClassifierTest(
     flowclassifier_client.FlowClassifierClientMixin,
     base.BaseAdminNetworkTest
 ):
+
+    @classmethod
+    def skip_checks(cls):
+        super(BaseFlowClassifierTest, cls).skip_checks()
+        msg = None
+        if not CONF.sfc.run_sfc_tests:
+            msg = ("Running of SFC related tests is disabled in "
+                   "plugin configuration.")
+        if msg:
+            raise cls.skipException(msg)
+
     @classmethod
     def resource_setup(cls):
         super(BaseFlowClassifierTest, cls).resource_setup()
diff --git a/neutron_tempest_plugin/sfc/tests/scenario/base.py b/neutron_tempest_plugin/sfc/tests/scenario/base.py
index d4cff18..44b5cd2 100644
--- a/neutron_tempest_plugin/sfc/tests/scenario/base.py
+++ b/neutron_tempest_plugin/sfc/tests/scenario/base.py
@@ -30,6 +30,17 @@
     sfc_client.SfcClientMixin,
     manager.NetworkScenarioTest
 ):
+
+    @classmethod
+    def skip_checks(cls):
+        super(SfcScenarioTest, cls).skip_checks()
+        msg = None
+        if not CONF.sfc.run_sfc_tests:
+            msg = ("Running of SFC related tests is disabled in "
+                   "plugin configuration.")
+        if msg:
+            raise cls.skipException(msg)
+
     def _check_connectivity(
         self, source_ip, destination_ip, routes=None,
         username=None, private_key=None