Merge "Check permutations of router migrations"
diff --git a/neutron/tests/tempest/api/admin/test_quotas.py b/neutron/tests/tempest/api/admin/test_quotas.py
index 9736d7f..79a430b 100644
--- a/neutron/tests/tempest/api/admin/test_quotas.py
+++ b/neutron/tests/tempest/api/admin/test_quotas.py
@@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@@ -83,7 +82,7 @@
# Change quotas for tenant
quota_set = self._setup_quotas(tenant_id, **new_quotas)
- for key, value in six.iteritems(new_quotas):
+ for key, value in new_quotas.items():
self.assertEqual(value, quota_set[key])
# Confirm our tenant is listed among tenants with non default quotas
@@ -97,7 +96,7 @@
# Confirm from API quotas were changed as requested for tenant
quota_set = self.admin_client.show_quotas(tenant_id)
quota_set = quota_set['quota']
- for key, value in six.iteritems(new_quotas):
+ for key, value in new_quotas.items():
self.assertEqual(value, quota_set[key])
# Reset quotas to default and confirm
diff --git a/neutron/tests/tempest/api/admin/test_shared_network_extension.py b/neutron/tests/tempest/api/admin/test_shared_network_extension.py
index 6f3e391..042a73e 100644
--- a/neutron/tests/tempest/api/admin/test_shared_network_extension.py
+++ b/neutron/tests/tempest/api/admin/test_shared_network_extension.py
@@ -279,6 +279,17 @@
# anchor is gone, delete should pass
self.admin_client.delete_rbac_policy(wild['id'])
+ @decorators.idempotent_id('34d627da-a732-68c0-2e1a-bc4a19246698')
+ def test_delete_self_share_rule(self):
+ net = self.create_network()
+ self_share = self.client.create_rbac_policy(
+ object_type='network', object_id=net['id'],
+ action='access_as_shared',
+ target_tenant=net['tenant_id'])['rbac_policy']
+ port = self.client.create_port(network_id=net['id'])['port']
+ self.client.delete_rbac_policy(self_share['id'])
+ self.client.delete_port(port['id'])
+
@decorators.idempotent_id('86c3529b-1231-40de-803c-beefbeefbeef')
def test_tenant_can_delete_port_on_own_network(self):
net = self.create_network() # owned by self.client
@@ -399,6 +410,18 @@
self.client.update_rbac_policy(pol['rbac_policy']['id'],
target_tenant='*')
+ @decorators.idempotent_id('34d627da-869f-68c0-2e1a-bc4a19246698')
+ def test_update_self_share_rule(self):
+ net = self.create_network()
+ self_share = self.client.create_rbac_policy(
+ object_type='network', object_id=net['id'],
+ action='access_as_shared',
+ target_tenant=net['tenant_id'])['rbac_policy']
+ port = self.client.create_port(network_id=net['id'])['port']
+ self.client.update_rbac_policy(self_share['id'],
+ target_tenant=self.client2.tenant_id)
+ self.client.delete_port(port['id'])
+
@decorators.idempotent_id('86c3529b-1231-40de-803c-aeeeeeee7fff')
def test_filtering_works_with_rbac_records_present(self):
resp = self._make_admin_net_and_subnet_shared_to_tenant_id(
diff --git a/neutron/tests/tempest/api/test_qos.py b/neutron/tests/tempest/api/test_qos.py
index 184c092..104fb9b 100644
--- a/neutron/tests/tempest/api/test_qos.py
+++ b/neutron/tests/tempest/api/test_qos.py
@@ -473,7 +473,7 @@
max_kbps=1,
max_burst_kbps=1)
self.assertRaises(
- exceptions.NotFound,
+ exceptions.Forbidden,
self.client.update_bandwidth_limit_rule,
policy['id'], rule['id'], max_kbps=2, max_burst_kbps=4)
diff --git a/neutron/tests/tempest/api/test_routers.py b/neutron/tests/tempest/api/test_routers.py
index d6beb77..7a1e458 100644
--- a/neutron/tests/tempest/api/test_routers.py
+++ b/neutron/tests/tempest/api/test_routers.py
@@ -14,7 +14,6 @@
# under the License.
import netaddr
-import six
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest import test
@@ -91,7 +90,7 @@
self.assertIsNone(actual_ext_gw_info)
return
# Verify only keys passed in exp_ext_gw_info
- for k, v in six.iteritems(exp_ext_gw_info):
+ for k, v in exp_ext_gw_info.items():
self.assertEqual(v, actual_ext_gw_info[k])
def _verify_gateway_port(self, router_id):
diff --git a/neutron/tests/tempest/api/test_security_groups_negative.py b/neutron/tests/tempest/api/test_security_groups_negative.py
index 9202060..1d841b1 100644
--- a/neutron/tests/tempest/api/test_security_groups_negative.py
+++ b/neutron/tests/tempest/api/test_security_groups_negative.py
@@ -13,12 +13,15 @@
# License for the specific language governing permissions and limitations
# under the License.
+from neutron_lib.db import constants as db_const
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.tests.tempest.api import base_security_groups as base
+LONG_NAME_NG = 'x' * (db_const.NAME_FIELD_SIZE + 1)
+
class NegativeSecGroupTest(base.BaseSecGroupTest):
@@ -28,6 +31,20 @@
super(NegativeSecGroupTest, cls).resource_setup()
@test.attr(type='negative')
+ @decorators.idempotent_id('594edfa8-9a5b-438e-9344-49aece337d49')
+ def test_create_security_group_with_too_long_name(self):
+ self.assertRaises(lib_exc.BadRequest,
+ self.client.create_security_group,
+ name=LONG_NAME_NG)
+
+ @test.attr(type='negative')
+ @decorators.idempotent_id('b6b79838-7430-4d3f-8e07-51dfb61802c2')
+ def test_create_security_group_with_boolean_type_name(self):
+ self.assertRaises(lib_exc.BadRequest,
+ self.client.create_security_group,
+ name=True)
+
+ @test.attr(type='negative')
@decorators.idempotent_id('55100aa8-b24f-333c-0bef-64eefd85f15c')
def test_update_default_security_group_name(self):
sg_list = self.client.list_security_groups(name='default')
@@ -35,6 +52,24 @@
self.assertRaises(lib_exc.Conflict, self.client.update_security_group,
sg['id'], name='test')
+ @test.attr(type='negative')
+ @decorators.idempotent_id('c8510dd8-c3a8-4df9-ae44-24354db50960')
+ def test_update_security_group_with_too_long_name(self):
+ sg_list = self.client.list_security_groups(name='default')
+ sg = sg_list['security_groups'][0]
+ self.assertRaises(lib_exc.BadRequest,
+ self.client.update_security_group,
+ sg['id'], name=LONG_NAME_NG)
+
+ @test.attr(type='negative')
+ @decorators.idempotent_id('d9a14917-f66f-4eca-ab72-018563917f1b')
+ def test_update_security_group_with_boolean_type_name(self):
+ sg_list = self.client.list_security_groups(name='default')
+ sg = sg_list['security_groups'][0]
+ self.assertRaises(lib_exc.BadRequest,
+ self.client.update_security_group,
+ sg['id'], name=True)
+
class NegativeSecGroupIPv6Test(NegativeSecGroupTest):
_ip_version = 6