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_routers.py b/neutron_tempest_plugin/api/test_routers.py
index 11fdecf..bc657e0 100644
--- a/neutron_tempest_plugin/api/test_routers.py
+++ b/neutron_tempest_plugin/api/test_routers.py
@@ -14,9 +14,9 @@
# under the License.
import netaddr
+from tempest.common import utils as tutils
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
-from tempest import test
from neutron_tempest_plugin.api import base
from neutron_tempest_plugin.api import base_routers
@@ -39,7 +39,7 @@
config.safe_get_config_value('network', 'project_network_v6_cidr'))
@decorators.idempotent_id('c72c1c0c-2193-4aca-eeee-b1442640eeee')
- @test.requires_ext(extension="standard-attr-description",
+ @tutils.requires_ext(extension="standard-attr-description",
service="network")
def test_create_update_router_description(self):
body = self.create_router(description='d1', router_name='test')
@@ -52,7 +52,7 @@
self.assertEqual('d2', body['description'])
@decorators.idempotent_id('847257cc-6afd-4154-b8fb-af49f5670ce8')
- @test.requires_ext(extension='ext-gw-mode', service='network')
+ @tutils.requires_ext(extension='ext-gw-mode', service='network')
def test_create_router_with_default_snat_value(self):
# Create a router with default snat rule
name = data_utils.rand_name('router')
@@ -63,7 +63,7 @@
'enable_snat': True})
@decorators.idempotent_id('ea74068d-09e9-4fd7-8995-9b6a1ace920f')
- @test.requires_ext(extension='ext-gw-mode', service='network')
+ @tutils.requires_ext(extension='ext-gw-mode', service='network')
def test_create_router_with_snat_explicit(self):
name = data_utils.rand_name('snat-router')
# Create a router enabling snat attributes
@@ -100,14 +100,15 @@
self.assertGreaterEqual(len(fixed_ips), 1)
public_net_body = self.admin_client.show_network(
CONF.network.public_network_id)
- public_subnet_id = public_net_body['network']['subnets'][0]
- self.assertIn(public_subnet_id,
- [x['subnet_id'] for x in fixed_ips])
+ public_subnet_ids = public_net_body['network']['subnets']
+ for fixed_ip in fixed_ips:
+ self.assertIn(fixed_ip['subnet_id'],
+ public_subnet_ids)
@decorators.idempotent_id('b386c111-3b21-466d-880c-5e72b01e1a33')
- @test.requires_ext(extension='ext-gw-mode', service='network')
+ @tutils.requires_ext(extension='ext-gw-mode', service='network')
def test_update_router_set_gateway_with_snat_explicit(self):
- router = self._create_router(data_utils.rand_name('router-'))
+ router = self._create_router(data_utils.rand_name('router'))
self.admin_client.update_router_with_snat_gw_info(
router['id'],
external_gateway_info={
@@ -120,9 +121,9 @@
self._verify_gateway_port(router['id'])
@decorators.idempotent_id('96536bc7-8262-4fb2-9967-5c46940fa279')
- @test.requires_ext(extension='ext-gw-mode', service='network')
+ @tutils.requires_ext(extension='ext-gw-mode', service='network')
def test_update_router_set_gateway_without_snat(self):
- router = self._create_router(data_utils.rand_name('router-'))
+ router = self._create_router(data_utils.rand_name('router'))
self.admin_client.update_router_with_snat_gw_info(
router['id'],
external_gateway_info={
@@ -135,10 +136,10 @@
self._verify_gateway_port(router['id'])
@decorators.idempotent_id('f2faf994-97f4-410b-a831-9bc977b64374')
- @test.requires_ext(extension='ext-gw-mode', service='network')
+ @tutils.requires_ext(extension='ext-gw-mode', service='network')
def test_update_router_reset_gateway_without_snat(self):
router = self._create_router(
- data_utils.rand_name('router-'),
+ data_utils.rand_name('router'),
external_network_id=CONF.network.public_network_id)
self.admin_client.update_router_with_snat_gw_info(
router['id'],
@@ -156,14 +157,14 @@
network = self.create_network()
subnet = self.create_subnet(network)
# Add router interface with subnet id
- router = self._create_router(data_utils.rand_name('router-'), True)
+ router = self._create_router(data_utils.rand_name('router'), True)
intf = self.create_router_interface(router['id'], subnet['id'])
status_active = lambda: self.client.show_port(
intf['port_id'])['port']['status'] == 'ACTIVE'
utils.wait_until_true(status_active, exception=AssertionError)
@decorators.idempotent_id('c86ac3a8-50bd-4b00-a6b8-62af84a0765c')
- @test.requires_ext(extension='extraroute', service='network')
+ @tutils.requires_ext(extension='extraroute', service='network')
def test_update_extra_route(self):
self.network = self.create_network()
self.name = self.network['name']