Merge "Add option for whether the cloud supports floating ips"

This commit is contained in:
Jenkins 2017-05-29 10:01:08 +00:00 committed by Gerrit Code Review
commit 9b4214b6ff
17 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
features:
- A new config option in the network-feature-enabled section, floating_ips,
to specify whether floating ips are available in the cloud under test. By
default this is set to True.

View File

@ -29,6 +29,12 @@ class FloatingIPsTestJSON(base.BaseFloatingIPsTest):
server_id = None server_id = None
floating_ip = None floating_ip = None
@classmethod
def skip_checks(cls):
super(FloatingIPsTestJSON, cls).skip_checks()
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod @classmethod
def setup_clients(cls): def setup_clients(cls):
super(FloatingIPsTestJSON, cls).setup_clients() super(FloatingIPsTestJSON, cls).setup_clients()

View File

@ -27,6 +27,12 @@ CONF = config.CONF
class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest): class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest):
@classmethod
def skip_checks(cls):
super(FloatingIPsNegativeTestJSON, cls).skip_checks()
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod @classmethod
def setup_clients(cls): def setup_clients(cls):
super(FloatingIPsNegativeTestJSON, cls).setup_clients() super(FloatingIPsNegativeTestJSON, cls).setup_clients()

View File

@ -23,6 +23,12 @@ CONF = config.CONF
class FloatingIPDetailsTestJSON(base.BaseV2ComputeTest): class FloatingIPDetailsTestJSON(base.BaseV2ComputeTest):
@classmethod
def skip_checks(cls):
super(FloatingIPDetailsTestJSON, cls).skip_checks()
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod @classmethod
def setup_clients(cls): def setup_clients(cls):
super(FloatingIPDetailsTestJSON, cls).setup_clients() super(FloatingIPDetailsTestJSON, cls).setup_clients()

View File

@ -25,6 +25,12 @@ CONF = config.CONF
class FloatingIPDetailsNegativeTestJSON(base.BaseV2ComputeTest): class FloatingIPDetailsNegativeTestJSON(base.BaseV2ComputeTest):
@classmethod
def skip_checks(cls):
super(FloatingIPDetailsNegativeTestJSON, cls).skip_checks()
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod @classmethod
def setup_clients(cls): def setup_clients(cls):
super(FloatingIPDetailsNegativeTestJSON, cls).setup_clients() super(FloatingIPDetailsNegativeTestJSON, cls).setup_clients()

View File

@ -65,6 +65,8 @@ class ServerRescueTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('4842e0cf-e87d-4d9d-b61f-f4791da3cacc') @decorators.idempotent_id('4842e0cf-e87d-4d9d-b61f-f4791da3cacc')
@testtools.skipUnless(CONF.network.public_network_id, @testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.') 'The public_network_id option must be specified.')
@testtools.skipUnless(CONF.network_feature_enabled.floating_ips,
"Floating ips are not available")
def test_rescued_vm_associate_dissociate_floating_ip(self): def test_rescued_vm_associate_dissociate_floating_ip(self):
# Association of floating IP to a rescued vm # Association of floating IP to a rescued vm
floating_ip_body = self.floating_ips_client.create_floating_ip( floating_ip_body = self.floating_ips_client.create_floating_ip(

View File

@ -10,11 +10,16 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import testtools
from tempest.api.network import base from tempest.api.network import base
from tempest import config
from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils from tempest.lib.common.utils import test_utils
from tempest.lib import decorators from tempest.lib import decorators
CONF = config.CONF
class ExternalNetworksTestJSON(base.BaseAdminNetworkTest): class ExternalNetworksTestJSON(base.BaseAdminNetworkTest):
@ -91,6 +96,8 @@ class ExternalNetworksTestJSON(base.BaseAdminNetworkTest):
self.assertFalse(show_net['router:external']) self.assertFalse(show_net['router:external'])
@decorators.idempotent_id('82068503-2cf2-4ed4-b3be-ecb89432e4bb') @decorators.idempotent_id('82068503-2cf2-4ed4-b3be-ecb89432e4bb')
@testtools.skipUnless(CONF.network_feature_enabled.floating_ips,
'Floating ips are not availabled')
def test_delete_external_networks_with_floating_ip(self): def test_delete_external_networks_with_floating_ip(self):
# Verifies external network can be deleted while still holding # Verifies external network can be deleted while still holding
# (unassociated) floating IPs # (unassociated) floating IPs

View File

@ -34,6 +34,8 @@ class FloatingIPAdminTestJSON(base.BaseAdminNetworkTest):
if not CONF.network.public_network_id: if not CONF.network.public_network_id:
msg = "The public_network_id option must be specified." msg = "The public_network_id option must be specified."
raise cls.skipException(msg) raise cls.skipException(msg)
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod @classmethod
def setup_clients(cls): def setup_clients(cls):

View File

@ -49,6 +49,8 @@ class FloatingIPTestJSON(base.BaseNetworkTest):
if not CONF.network.public_network_id: if not CONF.network.public_network_id:
msg = "The public_network_id option must be specified." msg = "The public_network_id option must be specified."
raise cls.skipException(msg) raise cls.skipException(msg)
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):

View File

@ -40,6 +40,8 @@ class FloatingIPNegativeTestJSON(base.BaseNetworkTest):
if not CONF.network.public_network_id: if not CONF.network.public_network_id:
msg = "The public_network_id option must be specified." msg = "The public_network_id option must be specified."
raise cls.skipException(msg) raise cls.skipException(msg)
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):

View File

@ -647,6 +647,9 @@ NetworkFeaturesGroup = [
cfg.BoolOpt('port_security', cfg.BoolOpt('port_security',
default=False, default=False,
help="Does the test environment support port security?"), help="Does the test environment support port security?"),
cfg.BoolOpt('floating_ips',
default=True,
help='Does the test environment support floating_ips')
] ]
validation_group = cfg.OptGroup(name='validation', validation_group = cfg.OptGroup(name='validation',

View File

@ -103,6 +103,8 @@ class TestMinimumBasicScenario(manager.ScenarioTest):
@decorators.idempotent_id('bdbb5441-9204-419d-a225-b4fdbfb1a1a8') @decorators.idempotent_id('bdbb5441-9204-419d-a225-b4fdbfb1a1a8')
@testtools.skipUnless(CONF.network.public_network_id, @testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.') 'The public_network_id option must be specified.')
@testtools.skipUnless(CONF.network_feature_enabled.floating_ips,
'Floating ips are not available')
@test.services('compute', 'volume', 'image', 'network') @test.services('compute', 'volume', 'image', 'network')
def test_minimum_basic_scenario(self): def test_minimum_basic_scenario(self):
image = self.glance_image_create() image = self.glance_image_create()

View File

@ -48,6 +48,8 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest):
msg = ('Either project_networks_reachable must be "true", or ' msg = ('Either project_networks_reachable must be "true", or '
'public_network_id must be defined.') 'public_network_id must be defined.')
raise cls.skipException(msg) raise cls.skipException(msg)
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod @classmethod
def setup_credentials(cls): def setup_credentials(cls):

View File

@ -90,6 +90,8 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
if not test.is_extension_enabled(ext, 'network'): if not test.is_extension_enabled(ext, 'network'):
msg = "%s extension not enabled." % ext msg = "%s extension not enabled." % ext
raise cls.skipException(msg) raise cls.skipException(msg)
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod @classmethod
def setup_credentials(cls): def setup_credentials(cls):

View File

@ -51,6 +51,8 @@ class TestGettingAddress(manager.NetworkScenarioTest):
if CONF.network.shared_physical_network: if CONF.network.shared_physical_network:
msg = 'Deployment uses a shared physical network' msg = 'Deployment uses a shared physical network'
raise cls.skipException(msg) raise cls.skipException(msg)
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod @classmethod
def setup_credentials(cls): def setup_credentials(cls):

View File

@ -148,6 +148,8 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
msg = ('Deployment uses a shared physical network, security ' msg = ('Deployment uses a shared physical network, security '
'groups not supported') 'groups not supported')
raise cls.skipException(msg) raise cls.skipException(msg)
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod @classmethod
def setup_credentials(cls): def setup_credentials(cls):

View File

@ -43,6 +43,12 @@ class TestServerBasicOps(manager.ScenarioTest):
* Terminate the instance * Terminate the instance
""" """
@classmethod
def skip_checks(cls):
super(TestServerBasicOps, cls).skip_checks()
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
def setUp(self): def setUp(self):
super(TestServerBasicOps, self).setUp() super(TestServerBasicOps, self).setUp()
self.run_ssh = CONF.validation.run_validation self.run_ssh = CONF.validation.run_validation