Merge "api-tests: Common way to define required extensions"

This commit is contained in:
Jenkins 2017-06-08 18:31:59 +00:00 committed by Gerrit Code Review
commit b6bd475629
33 changed files with 79 additions and 170 deletions

View File

@ -368,6 +368,12 @@ Tests for other resources should be contributed to the Neutron repository.
Scenario tests should be similarly split up between Tempest and Neutron Scenario tests should be similarly split up between Tempest and Neutron
according to the API they're targeting. according to the API they're targeting.
To create an API test, the testing class must at least inherit from
neutron.tests.tempest.api.base.BaseNetworkTest base class. As some of tests
may require certain extensions to be enabled, the base class provides
``required_extensions`` class attribute which can be used by subclasses to
define a list of required extensions for particular test class.
Scenario Tests Scenario Tests
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~

View File

@ -14,15 +14,15 @@
from neutron.tests.tempest.common import tempest_fixtures from neutron.tests.tempest.common import tempest_fixtures
from tempest.lib import decorators from tempest.lib import decorators
from tempest import test
from neutron.tests.tempest.api import base from neutron.tests.tempest.api import base
class AgentManagementTestJSON(base.BaseAdminNetworkTest): class AgentManagementTestJSON(base.BaseAdminNetworkTest):
required_extensions = ['agent']
@classmethod @classmethod
@test.requires_ext(extension="agent", service="network")
def resource_setup(cls): def resource_setup(cls):
super(AgentManagementTestJSON, cls).resource_setup() super(AgentManagementTestJSON, cls).resource_setup()
body = cls.admin_client.list_agents() body = cls.admin_client.list_agents()

View File

@ -14,7 +14,6 @@
from neutron_lib import constants from neutron_lib import constants
from tempest.lib import decorators from tempest.lib import decorators
from tempest import test
from neutron.common import utils from neutron.common import utils
from neutron.tests.tempest.api import base from neutron.tests.tempest.api import base
@ -22,8 +21,9 @@ from neutron.tests.tempest.api import base
class DHCPAgentSchedulersTestJSON(base.BaseAdminNetworkTest): class DHCPAgentSchedulersTestJSON(base.BaseAdminNetworkTest):
required_extensions = ['dhcp_agent_scheduler']
@classmethod @classmethod
@test.requires_ext(extension="dhcp_agent_scheduler", service="network")
def resource_setup(cls): def resource_setup(cls):
super(DHCPAgentSchedulersTestJSON, cls).resource_setup() super(DHCPAgentSchedulersTestJSON, cls).resource_setup()
# Create a network and make sure it will be hosted by a # Create a network and make sure it will be hosted by a

View File

@ -24,9 +24,10 @@ from neutron.tests.tempest.api import base_security_groups as base_security
class PortSecurityAdminTests(base_security.BaseSecGroupTest, class PortSecurityAdminTests(base_security.BaseSecGroupTest,
base.BaseAdminNetworkTest): base.BaseAdminNetworkTest):
required_extensions = ['port-security']
@test.attr(type='negative') @test.attr(type='negative')
@decorators.idempotent_id('d39a96e2-2dea-4feb-8093-e7ac991ce6f8') @decorators.idempotent_id('d39a96e2-2dea-4feb-8093-e7ac991ce6f8')
@test.requires_ext(extension='port-security', service='network')
def test_create_port_security_false_on_shared_network(self): def test_create_port_security_false_on_shared_network(self):
network = self.create_shared_network() network = self.create_shared_network()
self.assertTrue(network['shared']) self.assertTrue(network['shared'])

View File

@ -14,7 +14,6 @@ from oslo_config import cfg
from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import data_utils
from tempest.lib import decorators from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc from tempest.lib import exceptions as lib_exc
from tempest import test
import testtools import testtools
from neutron.tests.tempest.api import base from neutron.tests.tempest.api import base
@ -23,9 +22,9 @@ from neutron.tests.tempest.api import base
class ExternalNetworksRBACTestJSON(base.BaseAdminNetworkTest): class ExternalNetworksRBACTestJSON(base.BaseAdminNetworkTest):
credentials = ['primary', 'alt', 'admin'] credentials = ['primary', 'alt', 'admin']
required_extensions = ['rbac-policies']
@classmethod @classmethod
@test.requires_ext(extension="rbac-policies", service="network")
def resource_setup(cls): def resource_setup(cls):
super(ExternalNetworksRBACTestJSON, cls).resource_setup() super(ExternalNetworksRBACTestJSON, cls).resource_setup()
cls.client2 = cls.alt_manager.network_client cls.client2 = cls.alt_manager.network_client

View File

@ -14,7 +14,6 @@
from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import data_utils
from tempest.lib import decorators from tempest.lib import decorators
from tempest import test
from neutron.tests.tempest.api import base from neutron.tests.tempest.api import base
from neutron.tests.tempest import exceptions from neutron.tests.tempest import exceptions
@ -42,10 +41,7 @@ class L3AgentSchedulerTestJSON(base.BaseAdminNetworkTest):
The l3_agent_scheduler extension is required for these tests. The l3_agent_scheduler extension is required for these tests.
""" """
@classmethod required_extensions = ['l3_agent_scheduler']
@test.requires_ext(extension="l3_agent_scheduler", service="network")
def skip_checks(cls):
super(L3AgentSchedulerTestJSON, cls).skip_checks()
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):

View File

@ -26,8 +26,9 @@ CONF = config.CONF
class QuotasTestBase(base.BaseAdminNetworkTest): class QuotasTestBase(base.BaseAdminNetworkTest):
required_extensions = ['quotas']
@classmethod @classmethod
@test.requires_ext(extension="quotas", service="network")
def resource_setup(cls): def resource_setup(cls):
if not CONF.identity_feature_enabled.api_v2_admin: if not CONF.identity_feature_enabled.api_v2_admin:
# TODO(ihrachys) adopt to v3 # TODO(ihrachys) adopt to v3

View File

@ -15,16 +15,15 @@
from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import data_utils
from tempest.lib import decorators from tempest.lib import decorators
from tempest import test
from neutron.tests.tempest.api import base_routers as base from neutron.tests.tempest.api import base_routers as base
class RoutersTestDVR(base.BaseRouterTest): class RoutersTestDVR(base.BaseRouterTest):
required_extensions = ['router', 'dvr']
@classmethod @classmethod
@test.requires_ext(extension="router", service="network")
@test.requires_ext(extension="dvr", service="network")
def resource_setup(cls): def resource_setup(cls):
# The check above will pass if api_extensions=all, which does # The check above will pass if api_extensions=all, which does
# not mean DVR extension itself is present. # not mean DVR extension itself is present.

View File

@ -14,7 +14,6 @@
from neutron_lib import constants from neutron_lib import constants
from tempest.lib import decorators from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc from tempest.lib import exceptions as lib_exc
from tempest import test
import testtools import testtools
from neutron.tests.tempest.api import base_routers as base from neutron.tests.tempest.api import base_routers as base
@ -22,12 +21,7 @@ from neutron.tests.tempest.api import base_routers as base
class RoutersFlavorTestCase(base.BaseRouterTest): class RoutersFlavorTestCase(base.BaseRouterTest):
@classmethod required_extensions = ['router', 'flavors', 'l3-flavors']
@test.requires_ext(extension="router", service="network")
@test.requires_ext(extension="flavors", service="network")
@test.requires_ext(extension="l3-flavors", service="network")
def skip_checks(cls):
super(RoutersFlavorTestCase, cls).skip_checks()
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):

View File

@ -12,16 +12,15 @@
from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import data_utils
from tempest.lib import decorators from tempest.lib import decorators
from tempest import test
from neutron.tests.tempest.api import base_routers as base from neutron.tests.tempest.api import base_routers as base
class RoutersTestHA(base.BaseRouterTest): class RoutersTestHA(base.BaseRouterTest):
required_extensions = ['router', 'l3-ha']
@classmethod @classmethod
@test.requires_ext(extension="router", service="network")
@test.requires_ext(extension="l3-ha", service="network")
def resource_setup(cls): def resource_setup(cls):
# The check above will pass if api_extensions=all, which does # The check above will pass if api_extensions=all, which does
# not mean "l3-ha" extension itself is present. # not mean "l3-ha" extension itself is present.

View File

@ -148,11 +148,7 @@ class SharedNetworksTest(base.BaseAdminNetworkTest):
class AllowedAddressPairSharedNetworkTest(base.BaseAdminNetworkTest): class AllowedAddressPairSharedNetworkTest(base.BaseAdminNetworkTest):
allowed_address_pairs = [{'ip_address': '1.1.1.1'}] allowed_address_pairs = [{'ip_address': '1.1.1.1'}]
required_extensions = ['allowed-address-pairs']
@classmethod
@test.requires_ext(extension="allowed-address-pairs", service="network")
def skip_checks(cls):
super(AllowedAddressPairSharedNetworkTest, cls).skip_checks()
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):
@ -178,9 +174,9 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
force_tenant_isolation = True force_tenant_isolation = True
credentials = ['primary', 'alt', 'admin'] credentials = ['primary', 'alt', 'admin']
required_extensions = ['rbac-policies']
@classmethod @classmethod
@test.requires_ext(extension="rbac-policies", service="network")
def resource_setup(cls): def resource_setup(cls):
super(RBACSharedNetworksTest, cls).resource_setup() super(RBACSharedNetworksTest, cls).resource_setup()
cls.client2 = cls.alt_manager.network_client cls.client2 = cls.alt_manager.network_client

View File

@ -76,6 +76,10 @@ class BaseNetworkTest(test.BaseTestCase):
raise cls.skipException("Neutron support is required") raise cls.skipException("Neutron support is required")
if cls._ip_version == 6 and not CONF.network_feature_enabled.ipv6: if cls._ip_version == 6 and not CONF.network_feature_enabled.ipv6:
raise cls.skipException("IPv6 Tests are disabled.") raise cls.skipException("IPv6 Tests are disabled.")
for req_ext in getattr(cls, 'required_extensions', []):
if not test.is_extension_enabled(req_ext, 'network'):
msg = "%s extension not enabled." % req_ext
raise cls.skipException(msg)
@classmethod @classmethod
def setup_credentials(cls): def setup_credentials(cls):

View File

@ -25,10 +25,7 @@ ADDRESS_SCOPE_NAME = 'smoke-address-scope'
class AddressScopeTestBase(base.BaseAdminNetworkTest): class AddressScopeTestBase(base.BaseAdminNetworkTest):
@classmethod required_extensions = ['address-scope']
@test.requires_ext(extension="address-scope", service="network")
def resource_setup(cls):
super(AddressScopeTestBase, cls).resource_setup()
def _create_address_scope(self, is_admin=False, **kwargs): def _create_address_scope(self, is_admin=False, **kwargs):
name = data_utils.rand_name(ADDRESS_SCOPE_NAME) name = data_utils.rand_name(ADDRESS_SCOPE_NAME)

View File

@ -15,7 +15,6 @@
import netaddr import netaddr
from tempest.lib import decorators from tempest.lib import decorators
from tempest import test
from neutron.tests.tempest.api import base from neutron.tests.tempest.api import base
from neutron.tests.tempest import config from neutron.tests.tempest import config
@ -39,8 +38,9 @@ class AllowedAddressPairTestJSON(base.BaseNetworkTest):
api_extensions api_extensions
""" """
required_extensions = ['allowed-address-pairs']
@classmethod @classmethod
@test.requires_ext(extension="allowed-address-pairs", service="network")
def resource_setup(cls): def resource_setup(cls):
super(AllowedAddressPairTestJSON, cls).resource_setup() super(AllowedAddressPairTestJSON, cls).resource_setup()
cls.network = cls.create_network() cls.network = cls.create_network()

View File

@ -15,7 +15,6 @@
from oslo_config import cfg from oslo_config import cfg
from tempest.lib import decorators from tempest.lib import decorators
from tempest import test
from neutron.tests.tempest.api import base from neutron.tests.tempest.api import base
@ -31,11 +30,7 @@ class TestAutoAllocatedTopology(base.BaseAdminNetworkTest):
# all tests are added under TestAutoAllocatedTopology, # all tests are added under TestAutoAllocatedTopology,
# nothing bad should happen. # nothing bad should happen.
force_tenant_isolation = True force_tenant_isolation = True
required_extensions = ['auto-allocated-topology']
@classmethod
@test.requires_ext(extension="auto-allocated-topology", service="network")
def skip_checks(cls):
super(TestAutoAllocatedTopology, cls).skip_checks()
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):

View File

@ -15,7 +15,6 @@
from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import data_utils
from tempest.lib import decorators from tempest.lib import decorators
from tempest import test
from neutron.tests.tempest.api import base from neutron.tests.tempest.api import base
@ -36,8 +35,9 @@ class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest):
section of etc/tempest.conf section of etc/tempest.conf
""" """
required_extensions = ['extra_dhcp_opt']
@classmethod @classmethod
@test.requires_ext(extension="extra_dhcp_opt", service="network")
def resource_setup(cls): def resource_setup(cls):
super(ExtraDHCPOptionsTestJSON, cls).resource_setup() super(ExtraDHCPOptionsTestJSON, cls).resource_setup()
cls.network = cls.create_network() cls.network = cls.create_network()

View File

@ -14,7 +14,6 @@
from tempest.lib import decorators from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.tests.tempest.api import base from neutron.tests.tempest.api import base
@ -29,8 +28,9 @@ class TestFlavorsJson(base.BaseAdminNetworkTest):
List, Show, Create, Update, Delete service profiles List, Show, Create, Update, Delete service profiles
""" """
required_extensions = ['flavors']
@classmethod @classmethod
@test.requires_ext(extension="flavors", service="network")
def resource_setup(cls): def resource_setup(cls):
super(TestFlavorsJson, cls).resource_setup() super(TestFlavorsJson, cls).resource_setup()

View File

@ -25,8 +25,9 @@ CONF = config.CONF
class FloatingIPTestJSON(base.BaseNetworkTest): class FloatingIPTestJSON(base.BaseNetworkTest):
required_extensions = ['router']
@classmethod @classmethod
@test.requires_ext(extension="router", service="network")
def resource_setup(cls): def resource_setup(cls):
super(FloatingIPTestJSON, cls).resource_setup() super(FloatingIPTestJSON, cls).resource_setup()
cls.ext_net_id = CONF.network.public_network_id cls.ext_net_id = CONF.network.public_network_id

View File

@ -27,8 +27,9 @@ CONF = config.CONF
class FloatingIPNegativeTestJSON(base.BaseNetworkTest): class FloatingIPNegativeTestJSON(base.BaseNetworkTest):
required_extensions = ['router']
@classmethod @classmethod
@test.requires_ext(extension="router", service="network")
def resource_setup(cls): def resource_setup(cls):
super(FloatingIPNegativeTestJSON, cls).resource_setup() super(FloatingIPNegativeTestJSON, cls).resource_setup()
cls.ext_net_id = CONF.network.public_network_id cls.ext_net_id = CONF.network.public_network_id

View File

@ -15,7 +15,6 @@
from neutron_lib.db import constants as db_const from neutron_lib.db import constants as db_const
from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import data_utils
from tempest.lib import decorators from tempest.lib import decorators
from tempest import test
from neutron.tests.tempest.api import base from neutron.tests.tempest.api import base
@ -32,8 +31,9 @@ class MeteringTestJSON(base.BaseAdminNetworkTest):
List, Show, Create, Delete Metering labels rules List, Show, Create, Delete Metering labels rules
""" """
required_extensions = ['metering']
@classmethod @classmethod
@test.requires_ext(extension="metering", service="network")
def resource_setup(cls): def resource_setup(cls):
super(MeteringTestJSON, cls).resource_setup() super(MeteringTestJSON, cls).resource_setup()
description = "metering label created by tempest" description = "metering label created by tempest"

View File

@ -24,10 +24,7 @@ LONG_NAME_NG = 'x' * (db_const.NAME_FIELD_SIZE + 1)
class MeteringNegativeTestJSON(base.BaseAdminNetworkTest): class MeteringNegativeTestJSON(base.BaseAdminNetworkTest):
@classmethod required_extensions = ['metering']
@test.requires_ext(extension="metering", service="network")
def resource_setup(cls):
super(MeteringNegativeTestJSON, cls).resource_setup()
@test.attr(type='negative') @test.attr(type='negative')
@decorators.idempotent_id('8b3f7c84-9d37-4771-8681-bfd2c07f3c2d') @decorators.idempotent_id('8b3f7c84-9d37-4771-8681-bfd2c07f3c2d')

View File

@ -28,10 +28,8 @@ load_tests = testscenarios.load_tests_apply_scenarios
class QosTestJSON(base.BaseAdminNetworkTest): class QosTestJSON(base.BaseAdminNetworkTest):
@classmethod
@test.requires_ext(extension="qos", service="network") required_extensions = ['qos']
def resource_setup(cls):
super(QosTestJSON, cls).resource_setup()
@decorators.idempotent_id('108fbdf7-3463-4e47-9871-d07f3dcf5bbb') @decorators.idempotent_id('108fbdf7-3463-4e47-9871-d07f3dcf5bbb')
def test_create_policy(self): def test_create_policy(self):
@ -368,9 +366,9 @@ class QosTestJSON(base.BaseAdminNetworkTest):
class QosBandwidthLimitRuleTestJSON(base.BaseAdminNetworkTest): class QosBandwidthLimitRuleTestJSON(base.BaseAdminNetworkTest):
direction = None direction = None
required_extensions = ['qos']
@classmethod @classmethod
@test.requires_ext(extension="qos", service="network")
@base.require_qos_rule_type(qos_consts.RULE_TYPE_BANDWIDTH_LIMIT) @base.require_qos_rule_type(qos_consts.RULE_TYPE_BANDWIDTH_LIMIT)
def resource_setup(cls): def resource_setup(cls):
super(QosBandwidthLimitRuleTestJSON, cls).resource_setup() super(QosBandwidthLimitRuleTestJSON, cls).resource_setup()
@ -552,24 +550,23 @@ class QosBandwidthLimitRuleTestJSON(base.BaseAdminNetworkTest):
class QosBandwidthLimitRuleWithDirectionTestJSON( class QosBandwidthLimitRuleWithDirectionTestJSON(
QosBandwidthLimitRuleTestJSON): QosBandwidthLimitRuleTestJSON):
required_extensions = (
QosBandwidthLimitRuleTestJSON.required_extensions +
['qos-bw-limit-direction']
)
scenarios = [ scenarios = [
('ingress', {'direction': 'ingress'}), ('ingress', {'direction': 'ingress'}),
('egress', {'direction': 'egress'}), ('egress', {'direction': 'egress'}),
] ]
@classmethod
@test.requires_ext(extension="qos-bw-limit-direction", service="network")
def resource_setup(cls):
super(QosBandwidthLimitRuleWithDirectionTestJSON, cls).resource_setup()
class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest): class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
force_tenant_isolation = True force_tenant_isolation = True
credentials = ['primary', 'alt', 'admin'] credentials = ['primary', 'alt', 'admin']
required_extensions = ['qos']
@classmethod @classmethod
@test.requires_ext(extension="qos", service="network")
def resource_setup(cls): def resource_setup(cls):
super(RbacSharedQosPoliciesTest, cls).resource_setup() super(RbacSharedQosPoliciesTest, cls).resource_setup()
cls.client2 = cls.alt_manager.network_client cls.client2 = cls.alt_manager.network_client
@ -821,8 +818,9 @@ class QosDscpMarkingRuleTestJSON(base.BaseAdminNetworkTest):
VALID_DSCP_MARK1 = 56 VALID_DSCP_MARK1 = 56
VALID_DSCP_MARK2 = 48 VALID_DSCP_MARK2 = 48
required_extensions = ['qos']
@classmethod @classmethod
@test.requires_ext(extension="qos", service="network")
@base.require_qos_rule_type(qos_consts.RULE_TYPE_DSCP_MARKING) @base.require_qos_rule_type(qos_consts.RULE_TYPE_DSCP_MARKING)
def resource_setup(cls): def resource_setup(cls):
super(QosDscpMarkingRuleTestJSON, cls).resource_setup() super(QosDscpMarkingRuleTestJSON, cls).resource_setup()
@ -954,9 +952,9 @@ class QosMinimumBandwidthRuleTestJSON(base.BaseAdminNetworkTest):
DIRECTION_INGRESS = "ingress" DIRECTION_INGRESS = "ingress"
RULE_NAME = qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH + "_rule" RULE_NAME = qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH + "_rule"
RULES_NAME = RULE_NAME + "s" RULES_NAME = RULE_NAME + "s"
required_extensions = ['qos']
@classmethod @classmethod
@test.requires_ext(extension="qos", service="network")
@base.require_qos_rule_type(qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH) @base.require_qos_rule_type(qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH)
def resource_setup(cls): def resource_setup(cls):
super(QosMinimumBandwidthRuleTestJSON, cls).resource_setup() super(QosMinimumBandwidthRuleTestJSON, cls).resource_setup()
@ -1116,8 +1114,9 @@ class QosSearchCriteriaTest(base.BaseSearchCriteriaTest,
list_kwargs = {'description': 'search-criteria-test'} list_kwargs = {'description': 'search-criteria-test'}
list_as_admin = True list_as_admin = True
required_extensions = ['qos']
@classmethod @classmethod
@test.requires_ext(extension="qos", service="network")
def resource_setup(cls): def resource_setup(cls):
super(QosSearchCriteriaTest, cls).resource_setup() super(QosSearchCriteriaTest, cls).resource_setup()
for name in cls.resource_names: for name in cls.resource_names:

View File

@ -23,10 +23,8 @@ LONG_TENANT_ID_NG = 'z' * (db_const.PROJECT_ID_FIELD_SIZE + 1)
class QosNegativeTestJSON(base.BaseAdminNetworkTest): class QosNegativeTestJSON(base.BaseAdminNetworkTest):
@classmethod
@test.requires_ext(extension="qos", service="network") required_extensions = ['qos']
def resource_setup(cls):
super(QosNegativeTestJSON, cls).resource_setup()
@test.attr(type='negative') @test.attr(type='negative')
@decorators.idempotent_id('b9dce555-d3b3-11e5-950a-54ee757c77da') @decorators.idempotent_id('b9dce555-d3b3-11e5-950a-54ee757c77da')

View File

@ -22,10 +22,7 @@ from neutron.tests.tempest import config
class TestRevisions(base.BaseAdminNetworkTest, bsg.BaseSecGroupTest): class TestRevisions(base.BaseAdminNetworkTest, bsg.BaseSecGroupTest):
@classmethod required_extensions = ['standard-attr-revisions']
@test.requires_ext(extension="standard-attr-revisions", service="network")
def skip_checks(cls):
super(TestRevisions, cls).skip_checks()
@decorators.idempotent_id('4a26a4be-9c53-483c-bc50-b53f1db10ac6') @decorators.idempotent_id('4a26a4be-9c53-483c-bc50-b53f1db10ac6')
def test_update_network_bumps_revision(self): def test_update_network_bumps_revision(self):

View File

@ -28,10 +28,7 @@ CONF = config.CONF
class RoutersTest(base_routers.BaseRouterTest): class RoutersTest(base_routers.BaseRouterTest):
@classmethod required_extensions = ['router']
@test.requires_ext(extension="router", service="network")
def skip_checks(cls):
super(RoutersTest, cls).skip_checks()
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):
@ -231,10 +228,7 @@ class RoutersIpV6Test(RoutersTest):
class DvrRoutersTest(base_routers.BaseRouterTest): class DvrRoutersTest(base_routers.BaseRouterTest):
@classmethod required_extensions = ['dvr']
@test.requires_ext(extension="dvr", service="network")
def skip_checks(cls):
super(DvrRoutersTest, cls).skip_checks()
@decorators.idempotent_id('141297aa-3424-455d-aa8d-f2d95731e00a') @decorators.idempotent_id('141297aa-3424-455d-aa8d-f2d95731e00a')
def test_create_distributed_router(self): def test_create_distributed_router(self):
@ -261,10 +255,7 @@ class DvrRoutersTest(base_routers.BaseRouterTest):
class HaRoutersTest(base_routers.BaseRouterTest): class HaRoutersTest(base_routers.BaseRouterTest):
@classmethod required_extensions = ['l3-ha']
@test.requires_ext(extension="l3-ha", service="network")
def skip_checks(cls):
super(HaRoutersTest, cls).skip_checks()
@decorators.idempotent_id('77db8eae-3aa3-4e61-bf2a-e739ce042e53') @decorators.idempotent_id('77db8eae-3aa3-4e61-bf2a-e739ce042e53')
def test_convert_legacy_router(self): def test_convert_legacy_router(self):
@ -281,13 +272,9 @@ class HaRoutersTest(base_routers.BaseRouterTest):
class RoutersSearchCriteriaTest(base.BaseSearchCriteriaTest): class RoutersSearchCriteriaTest(base.BaseSearchCriteriaTest):
required_extensions = ['router']
resource = 'router' resource = 'router'
@classmethod
@test.requires_ext(extension="router", service="network")
def skip_checks(cls):
super(RoutersSearchCriteriaTest, cls).skip_checks()
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):
super(RoutersSearchCriteriaTest, cls).resource_setup() super(RoutersSearchCriteriaTest, cls).resource_setup()

View File

@ -24,10 +24,7 @@ from neutron.tests.tempest.api import base_routers as base
class RoutersNegativeTestBase(base.BaseRouterTest): class RoutersNegativeTestBase(base.BaseRouterTest):
@classmethod required_extensions = ['router']
@test.requires_ext(extension="router", service="network")
def skip_checks(cls):
super(RoutersNegativeTestBase, cls).skip_checks()
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):
@ -74,10 +71,7 @@ class RoutersNegativePolicyTest(RoutersNegativeTestBase):
class DvrRoutersNegativeTest(RoutersNegativeTestBase): class DvrRoutersNegativeTest(RoutersNegativeTestBase):
@classmethod required_extensions = ['dvr']
@test.requires_ext(extension="dvr", service="network")
def skip_checks(cls):
super(DvrRoutersNegativeTest, cls).skip_checks()
@test.attr(type='negative') @test.attr(type='negative')
@decorators.idempotent_id('4990b055-8fc7-48ab-bba7-aa28beaad0b9') @decorators.idempotent_id('4990b055-8fc7-48ab-bba7-aa28beaad0b9')
@ -89,10 +83,7 @@ class DvrRoutersNegativeTest(RoutersNegativeTestBase):
class HaRoutersNegativeTest(RoutersNegativeTestBase): class HaRoutersNegativeTest(RoutersNegativeTestBase):
@classmethod required_extensions = ['l3-ha']
@test.requires_ext(extension="l3-ha", service="network")
def skip_checks(cls):
super(HaRoutersNegativeTest, cls).skip_checks()
@test.attr(type='negative') @test.attr(type='negative')
@decorators.idempotent_id('821b85b9-9c51-40f3-831f-bf223a7e0084') @decorators.idempotent_id('821b85b9-9c51-40f3-831f-bf223a7e0084')

View File

@ -15,17 +15,13 @@
from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import data_utils
from tempest.lib import decorators from tempest.lib import decorators
from tempest import test
from neutron.tests.tempest.api import base_security_groups as base from neutron.tests.tempest.api import base_security_groups as base
class SecGroupTest(base.BaseSecGroupTest): class SecGroupTest(base.BaseSecGroupTest):
@classmethod required_extensions = ['security-group']
@test.requires_ext(extension="security-group", service="network")
def resource_setup(cls):
super(SecGroupTest, cls).resource_setup()
@decorators.idempotent_id('bfd128e5-3c92-44b6-9d66-7fe29d22c802') @decorators.idempotent_id('bfd128e5-3c92-44b6-9d66-7fe29d22c802')
def test_create_list_update_show_delete_security_group(self): def test_create_list_update_show_delete_security_group(self):

View File

@ -25,10 +25,7 @@ LONG_NAME_NG = 'x' * (db_const.NAME_FIELD_SIZE + 1)
class NegativeSecGroupTest(base.BaseSecGroupTest): class NegativeSecGroupTest(base.BaseSecGroupTest):
@classmethod required_extensions = ['security-group']
@test.requires_ext(extension="security-group", service="network")
def resource_setup(cls):
super(NegativeSecGroupTest, cls).resource_setup()
@test.attr(type='negative') @test.attr(type='negative')
@decorators.idempotent_id('594edfa8-9a5b-438e-9344-49aece337d49') @decorators.idempotent_id('594edfa8-9a5b-438e-9344-49aece337d49')

View File

@ -11,17 +11,13 @@
# under the License. # under the License.
from tempest.lib import decorators from tempest.lib import decorators
from tempest import test
from neutron.tests.tempest.api import base from neutron.tests.tempest.api import base
class ServiceTypeManagementTest(base.BaseNetworkTest): class ServiceTypeManagementTest(base.BaseNetworkTest):
@classmethod required_extensions = ['service-type']
@test.requires_ext(extension="service-type", service="network")
def resource_setup(cls):
super(ServiceTypeManagementTest, cls).resource_setup()
@decorators.idempotent_id('2cbbeea9-f010-40f6-8df5-4eaa0c918ea6') @decorators.idempotent_id('2cbbeea9-f010-40f6-8df5-4eaa0c918ea6')
def test_service_provider_list(self): def test_service_provider_list(self):

View File

@ -19,8 +19,9 @@ from neutron.tests.tempest.api import base
class TagTestJSON(base.BaseAdminNetworkTest): class TagTestJSON(base.BaseAdminNetworkTest):
required_extensions = ['tag']
@classmethod @classmethod
@test.requires_ext(extension="tag", service="network")
def resource_setup(cls): def resource_setup(cls):
super(TagTestJSON, cls).resource_setup() super(TagTestJSON, cls).resource_setup()
cls.res_id = cls._create_resource() cls.res_id = cls._create_resource()
@ -154,9 +155,9 @@ class TagRouterTestJSON(TagTestJSON):
class TagFilterTestJSON(base.BaseAdminNetworkTest): class TagFilterTestJSON(base.BaseAdminNetworkTest):
credentials = ['primary', 'alt', 'admin'] credentials = ['primary', 'alt', 'admin']
required_extensions = ['tag']
@classmethod @classmethod
@test.requires_ext(extension="tag", service="network")
def resource_setup(cls): def resource_setup(cls):
super(TagFilterTestJSON, cls).resource_setup() super(TagFilterTestJSON, cls).resource_setup()
@ -323,10 +324,7 @@ class TagFilterRouterTestJSON(TagFilterTestJSON):
class UpdateTagsTest(base.BaseAdminNetworkTest): class UpdateTagsTest(base.BaseAdminNetworkTest):
@classmethod required_extensions = ['tag']
@test.requires_ext(extension="tag", service="network")
def resource_setup(cls):
super(UpdateTagsTest, cls).resource_setup()
def _get_and_compare_tags(self, tags, res_id): def _get_and_compare_tags(self, tags, res_id):
# nothing specific about networks here, just a resource that is # nothing specific about networks here, just a resource that is

View File

@ -14,7 +14,6 @@ import copy
from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import data_utils
from tempest.lib import decorators from tempest.lib import decorators
from tempest import test
from neutron.tests.tempest.api import base from neutron.tests.tempest.api import base
from neutron.tests.tempest.api import base_routers from neutron.tests.tempest.api import base_routers
@ -26,6 +25,8 @@ CONF = config.CONF
class TestTimeStamp(base.BaseAdminNetworkTest): class TestTimeStamp(base.BaseAdminNetworkTest):
required_extensions = ["standard-attr-timestamp"]
## attributes for subnetpool ## attributes for subnetpool
min_prefixlen = '28' min_prefixlen = '28'
max_prefixlen = '31' max_prefixlen = '31'
@ -34,11 +35,6 @@ class TestTimeStamp(base.BaseAdminNetworkTest):
new_prefix = '10.11.15.0/24' new_prefix = '10.11.15.0/24'
larger_prefix = '10.11.0.0/16' larger_prefix = '10.11.0.0/16'
@classmethod
@test.requires_ext(extension="standard-attr-timestamp", service="network")
def skip_checks(cls):
super(TestTimeStamp, cls).skip_checks()
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):
super(TestTimeStamp, cls).resource_setup() super(TestTimeStamp, cls).resource_setup()
@ -183,13 +179,8 @@ class TestTimeStamp(base.BaseAdminNetworkTest):
class TestTimeStampWithL3(base_routers.BaseRouterTest): class TestTimeStampWithL3(base_routers.BaseRouterTest):
@classmethod
def skip_checks(cls):
super(TestTimeStampWithL3, cls).skip_checks()
if not test.is_extension_enabled('standard-attr-timestamp', 'network'): required_extensions = ['standard-attr-timestamp']
raise cls.skipException("standard-attr-timestamp extension not "
"enabled")
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):
@ -260,13 +251,8 @@ class TestTimeStampWithL3(base_routers.BaseRouterTest):
class TestTimeStampWithSecurityGroup(base_security_groups.BaseSecGroupTest): class TestTimeStampWithSecurityGroup(base_security_groups.BaseSecGroupTest):
@classmethod
def skip_checks(cls):
super(TestTimeStampWithSecurityGroup, cls).skip_checks()
if not test.is_extension_enabled('standard-attr-timestamp', 'network'): required_extensions = ['standard-attr-timestamp']
raise cls.skipException("standard-attr-timestamp extension not "
"enabled")
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):

View File

@ -38,19 +38,12 @@ def trunks_cleanup(client, trunks):
class TrunkTestJSONBase(base.BaseAdminNetworkTest): class TrunkTestJSONBase(base.BaseAdminNetworkTest):
extension = 'trunk' required_extensions = ['trunk']
def setUp(self): def setUp(self):
self.addCleanup(self.resource_cleanup) self.addCleanup(self.resource_cleanup)
super(TrunkTestJSONBase, self).setUp() super(TrunkTestJSONBase, self).setUp()
@classmethod
def skip_checks(cls):
super(TrunkTestJSONBase, cls).skip_checks()
if not test.is_extension_enabled(cls.extension, 'network'):
msg = "%s extension not enabled." % cls.extension
raise cls.skipException(msg)
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):
super(TrunkTestJSONBase, cls).resource_setup() super(TrunkTestJSONBase, cls).resource_setup()
@ -227,10 +220,6 @@ class TrunkTestInheritJSONBase(TrunkTestJSONBase):
@classmethod @classmethod
def skip_checks(cls): def skip_checks(cls):
super(TrunkTestInheritJSONBase, cls).skip_checks() super(TrunkTestInheritJSONBase, cls).skip_checks()
for ext in cls.required_extensions:
if not test.is_extension_enabled(ext, 'network'):
msg = "%s extension not enabled." % ext
raise cls.skipException(msg)
if ("vlan" not in if ("vlan" not in
config.CONF.neutron_plugin_options.available_type_drivers): config.CONF.neutron_plugin_options.available_type_drivers):
raise cls.skipException("VLAN type_driver is not enabled") raise cls.skipException("VLAN type_driver is not enabled")
@ -277,11 +266,6 @@ class TrunkTestMtusJSONBase(TrunkTestJSONBase):
@classmethod @classmethod
def skip_checks(cls): def skip_checks(cls):
super(TrunkTestMtusJSONBase, cls).skip_checks() super(TrunkTestMtusJSONBase, cls).skip_checks()
for ext in cls.required_extensions:
if not test.is_extension_enabled(ext, 'network'):
msg = "%s extension not enabled." % ext
raise cls.skipException(msg)
if any(t if any(t
not in config.CONF.neutron_plugin_options.available_type_drivers not in config.CONF.neutron_plugin_options.available_type_drivers
for t in ['gre', 'vxlan']): for t in ['gre', 'vxlan']):
@ -351,15 +335,9 @@ class TrunkTestMtusJSON(TrunkTestMtusJSONBase):
class TrunksSearchCriteriaTest(base.BaseSearchCriteriaTest): class TrunksSearchCriteriaTest(base.BaseSearchCriteriaTest):
required_extensions = ['trunk']
resource = 'trunk' resource = 'trunk'
@classmethod
def skip_checks(cls):
super(TrunksSearchCriteriaTest, cls).skip_checks()
if not test.is_extension_enabled('trunk', 'network'):
msg = "trunk extension not enabled."
raise cls.skipException(msg)
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):
super(TrunksSearchCriteriaTest, cls).resource_setup() super(TrunksSearchCriteriaTest, cls).resource_setup()

View File

@ -19,7 +19,7 @@ from neutron.tests.tempest.api import test_trunk
class TestTrunkDetailsJSON(test_trunk.TrunkTestJSONBase): class TestTrunkDetailsJSON(test_trunk.TrunkTestJSONBase):
extension = 'trunk-details' required_extensions = ['trunk-details']
@decorators.idempotent_id('f0bed24f-d36a-498b-b4e7-0d66e3fb7308') @decorators.idempotent_id('f0bed24f-d36a-498b-b4e7-0d66e3fb7308')
def test_port_resource_trunk_details_no_subports(self): def test_port_resource_trunk_details_no_subports(self):