Merge "Using a new security group in scenario tests"
diff --git a/neutron/tests/tempest/api/test_dhcp_ipv6.py b/neutron/tests/tempest/api/test_dhcp_ipv6.py
index e136efa..bf45825 100644
--- a/neutron/tests/tempest/api/test_dhcp_ipv6.py
+++ b/neutron/tests/tempest/api/test_dhcp_ipv6.py
@@ -14,10 +14,10 @@
 #    under the License.
 
 import netaddr
+from neutron_lib import constants
 from tempest.lib import exceptions as lib_exc
 from tempest import test
 
-from neutron.common import constants
 from neutron.tests.tempest.api import base
 from neutron.tests.tempest import config
 
diff --git a/neutron/tests/tempest/api/test_floating_ips.py b/neutron/tests/tempest/api/test_floating_ips.py
index bafa54c..6e722db 100644
--- a/neutron/tests/tempest/api/test_floating_ips.py
+++ b/neutron/tests/tempest/api/test_floating_ips.py
@@ -100,4 +100,4 @@
         # disassociate
         body = self.client.update_floatingip(body['floatingip']['id'],
                                              port_id=None)
-        self.assertEqual(None, body['floatingip']['port_id'])
+        self.assertIsNone(body['floatingip']['port_id'])
diff --git a/neutron/tests/tempest/api/test_qos_negative.py b/neutron/tests/tempest/api/test_qos_negative.py
new file mode 100644
index 0000000..bc3222a
--- /dev/null
+++ b/neutron/tests/tempest/api/test_qos_negative.py
@@ -0,0 +1,50 @@
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+from tempest.lib import exceptions as lib_exc
+from tempest import test
+
+from neutron.api.v2 import attributes as attr
+from neutron.tests.tempest.api import base
+
+LONG_NAME_NG = 'z' * (attr.NAME_MAX_LEN + 1)
+LONG_DESCRIPTION_NG = 'z' * (attr.LONG_DESCRIPTION_MAX_LEN + 1)
+LONG_TENANT_ID_NG = 'z' * (attr.TENANT_ID_MAX_LEN + 1)
+
+
+class QosNegativeTestJSON(base.BaseAdminNetworkTest):
+    @classmethod
+    @test.requires_ext(extension="qos", service="network")
+    def resource_setup(cls):
+        super(QosNegativeTestJSON, cls).resource_setup()
+
+    @test.attr(type='negative')
+    @test.idempotent_id('b9dce555-d3b3-11e5-950a-54ee757c77da')
+    def test_add_policy_with_too_long_name(self):
+        self.assertRaises(lib_exc.BadRequest,
+                          self.client.create_qos_policy,
+                          LONG_NAME_NG, 'test policy desc1', False)
+
+    @test.attr(type='negative')
+    @test.idempotent_id('b9dce444-d3b3-11e5-950a-54ee747c99db')
+    def test_add_policy_with_too_long_description(self):
+        self.assertRaises(lib_exc.BadRequest,
+                          self.client.create_qos_policy,
+                          'test-policy', LONG_DESCRIPTION_NG, False)
+
+    @test.attr(type='negative')
+    @test.idempotent_id('b9dce444-d3b3-11e5-950a-54ee757c77dc')
+    def test_add_policy_with_too_long_tenant_id(self):
+        self.assertRaises(lib_exc.BadRequest,
+                          self.client.create_qos_policy,
+                          'test-policy', 'test policy desc1',
+                          False, LONG_TENANT_ID_NG)
diff --git a/neutron/tests/tempest/api/test_revisions.py b/neutron/tests/tempest/api/test_revisions.py
index 6a2ff88..cdcb367 100644
--- a/neutron/tests/tempest/api/test_revisions.py
+++ b/neutron/tests/tempest/api/test_revisions.py
@@ -261,3 +261,54 @@
                            body['revision_number'])
         # disassociate
         self.client.update_floatingip(b2['floatingip']['id'], port_id=None)
+
+    @test.idempotent_id('afb6486c-41b5-483e-a500-3c506f4deb49')
+    @test.requires_ext(extension="router", service="network")
+    @test.requires_ext(extension="dvr", service="network")
+    def test_update_router_extra_attributes_bumps_revision(self):
+        router = self.create_router(router_name='r1')
+        self.assertIn('revision_number', router)
+        rev1 = router['revision_number']
+        router = self.admin_client.update_router(
+            router['id'], admin_state_up=False)['router']
+        self.assertGreater(router['revision_number'], rev1)
+        self.admin_client.update_router(router['id'],
+                                        distributed=True)['router']
+        updated = self.client.show_router(router['id'])['router']
+        self.assertGreater(updated['revision_number'],
+                           router['revision_number'])
+
+    @test.idempotent_id('90743b00-b0e2-40e4-9524-1c884fe3ef23')
+    @test.requires_ext(extension="external-network", service="network")
+    @test.requires_ext(extension="auto-allocated-topology", service="network")
+    @test.requires_ext(extension="subnet_allocation", service="network")
+    @test.requires_ext(extension="router", service="network")
+    def test_update_external_network_bumps_revision(self):
+        net = self.create_network()
+        self.assertIn('revision_number', net)
+        updated = self.admin_client.update_network(net['id'],
+                                                   **{'router:external': True})
+        self.assertGreater(updated['network']['revision_number'],
+                           net['revision_number'])
+
+    @test.idempotent_id('5af6450a-0f61-49c3-b628-38db77c7b856')
+    @test.requires_ext(extension="qos", service="network")
+    def test_update_qos_port_policy_binding_bumps_revision(self):
+        policy = self.create_qos_policy(name='port-policy', shared=False)
+        port = self.create_port(self.create_network())
+        self.addCleanup(self.client.delete_port, port['id'])
+        updated = self.admin_client.update_port(
+            port['id'], qos_policy_id=policy['id'])
+        self.assertGreater(updated['port']['revision_number'],
+                           port['revision_number'])
+
+    @test.idempotent_id('817da343-c6e4-445c-9519-a621f124dfbe')
+    @test.requires_ext(extension="qos", service="network")
+    def test_update_qos_network_policy_binding_bumps_revision(self):
+        policy = self.create_qos_policy(name='network-policy', shared=False)
+        network = self.create_network()
+        self.addCleanup(self.client.delete_network, network['id'])
+        updated = self.admin_client.update_network(
+            network['id'], qos_policy_id=policy['id'])
+        self.assertGreater(updated['network']['revision_number'],
+                           network['revision_number'])