Code Sync from neutron project to newly created neutron-tempest-plugin
* The following commit sync the code from following hash:
start_hash: 7279aa35851110a4933a10b58b2758a2bc3933a3
end_hash: 6e911a49a9e630878f4c46f61fde3964be550880
Change-Id: I371aa4d5f043f695df04b98b0f485c8f0548f2b3
diff --git a/neutron_tempest_plugin/api/test_subnetpools.py b/neutron_tempest_plugin/api/test_subnetpools.py
index 5da0ad8..dc822e3 100644
--- a/neutron_tempest_plugin/api/test_subnetpools.py
+++ b/neutron_tempest_plugin/api/test_subnetpools.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
-from tempest import test
from neutron_tempest_plugin.api import base
@@ -105,7 +105,7 @@
"Created subnetpool name should be in the list")
@decorators.idempotent_id('c72c1c0c-2193-4aca-ddd4-b1442640bbbb')
- @test.requires_ext(extension="standard-attr-description",
+ @utils.requires_ext(extension="standard-attr-description",
service="network")
def test_create_update_subnetpool_description(self):
body = self._create_subnetpool(description='d1')
@@ -135,7 +135,7 @@
self.assertFalse(subnetpool['shared'])
@decorators.idempotent_id('5bf9f1e2-efc8-4195-acf3-d12b2bd68dd3')
- @test.requires_ext(extension="project-id", service="network")
+ @utils.requires_ext(extension="project-id", service="network")
def test_show_subnetpool_has_project_id(self):
subnetpool = self._create_subnetpool()
body = self.client.show_subnetpool(subnetpool['id'])
@@ -259,7 +259,7 @@
self.assertTrue(cidr.endswith(str(self.max_prefixlen)))
@decorators.idempotent_id('49b44c64-1619-4b29-b527-ffc3c3115dc4')
- @test.requires_ext(extension='address-scope', service='network')
+ @utils.requires_ext(extension='address-scope', service='network')
def test_create_subnetpool_associate_address_scope(self):
address_scope = self.create_address_scope(
name=data_utils.rand_name('smoke-address-scope'),
@@ -271,7 +271,7 @@
body['subnetpool']['address_scope_id'])
@decorators.idempotent_id('910b6393-db24-4f6f-87dc-b36892ad6c8c')
- @test.requires_ext(extension='address-scope', service='network')
+ @utils.requires_ext(extension='address-scope', service='network')
def test_update_subnetpool_associate_address_scope(self):
address_scope = self.create_address_scope(
name=data_utils.rand_name('smoke-address-scope'),
@@ -287,7 +287,7 @@
body['subnetpool']['address_scope_id'])
@decorators.idempotent_id('18302e80-46a3-4563-82ac-ccd1dd57f652')
- @test.requires_ext(extension='address-scope', service='network')
+ @utils.requires_ext(extension='address-scope', service='network')
def test_update_subnetpool_associate_another_address_scope(self):
address_scope = self.create_address_scope(
name=data_utils.rand_name('smoke-address-scope'),
@@ -308,7 +308,7 @@
body['subnetpool']['address_scope_id'])
@decorators.idempotent_id('f8970048-e41b-42d6-934b-a1297b07706a')
- @test.requires_ext(extension='address-scope', service='network')
+ @utils.requires_ext(extension='address-scope', service='network')
def test_update_subnetpool_disassociate_address_scope(self):
address_scope = self.create_address_scope(
name=data_utils.rand_name('smoke-address-scope'),
@@ -325,7 +325,7 @@
self.assertIsNone(body['subnetpool']['address_scope_id'])
@decorators.idempotent_id('4c6963c2-f54c-4347-b288-75d18421c4c4')
- @test.requires_ext(extension='default-subnetpools', service='network')
+ @utils.requires_ext(extension='default-subnetpools', service='network')
def test_tenant_create_non_default_subnetpool(self):
"""
Test creates a subnetpool, the "is_default" attribute is False.
@@ -334,69 +334,6 @@
self.assertFalse(created_subnetpool['is_default'])
-class DefaultSubnetPoolsTest(SubnetPoolsTestBase):
-
- def setUp(self):
- self.addCleanup(self.resource_cleanup)
- super(DefaultSubnetPoolsTest, self).setUp()
-
- @classmethod
- def resource_setup(cls):
- super(DefaultSubnetPoolsTest, cls).resource_setup()
- body = cls.admin_client.list_subnetpools()
- subnetpools = body['subnetpools']
- for subnetpool in subnetpools:
- if subnetpool.get('is_default'):
- msg = 'Default subnetpool already exists. Only one is allowed.'
- raise cls.skipException(msg)
-
- @decorators.idempotent_id('cb839106-6184-4332-b292-5d07c074de4f')
- @test.requires_ext(extension='default-subnetpools', service='network')
- def test_admin_create_default_subnetpool(self):
- """
- Test uses administrative credentials to create a default subnetpool,
- using the is_default=True.
- """
- created_subnetpool = self._create_subnetpool(is_admin=True,
- is_default=True)
- self.assertTrue(created_subnetpool['is_default'])
-
- @decorators.idempotent_id('9e79730c-29b6-44a4-9504-bf3c7cedc56c')
- @test.requires_ext(extension='default-subnetpools', service='network')
- def test_convert_subnetpool_to_default_subnetpool(self):
- """
- Test creates a subnetpool, which is non default subnetpool.
- Then it will update to a default subnetpool, by setting "is_default"
- attribute to True.
- """
- created_subnetpool = self._create_subnetpool()
- subnetpool_id = created_subnetpool['id']
- self.assertFalse(created_subnetpool['is_default'])
- subnetpool_data = {'is_default': True}
- self.admin_client.update_subnetpool(subnetpool_id,
- **subnetpool_data)
- show_body = self.client.show_subnetpool(subnetpool_id)
- self.assertTrue(show_body['subnetpool']['is_default'])
-
- @decorators.idempotent_id('39687561-7a37-47b8-91ce-f9143ae26969')
- @test.requires_ext(extension='default-subnetpools', service='network')
- def test_convert_default_subnetpool_to_non_default(self):
- """
- Test uses administrative credentials to create a default subnetpool,
- using the is_default=True.
- Then it will update "is_default" attribute to False.
- """
- created_subnetpool = self._create_subnetpool(is_admin=True,
- is_default=True)
- subnetpool_id = created_subnetpool['id']
- self.assertTrue(created_subnetpool['is_default'])
- subnetpool_data = {'is_default': False}
- self.admin_client.update_subnetpool(subnetpool_id,
- **subnetpool_data)
- show_body = self.admin_client.show_subnetpool(subnetpool_id)
- self.assertFalse(show_body['subnetpool']['is_default'])
-
-
class SubnetPoolsTestV6(SubnetPoolsTest):
min_prefixlen = '48'