Merge "Add API tests for router and DHCP port status"
diff --git a/neutron/tests/tempest/api/test_networks.py b/neutron/tests/tempest/api/test_networks.py
index 951e8c9..16fe81b 100644
--- a/neutron/tests/tempest/api/test_networks.py
+++ b/neutron/tests/tempest/api/test_networks.py
@@ -103,47 +103,38 @@
         for name in cls.resource_names:
             cls.create_network(network_name=name)
 
-    @test.attr(type='smoke')
     @test.idempotent_id('de27d34a-bd9d-4516-83d6-81ef723f7d0d')
     def test_list_sorts_asc(self):
         self._test_list_sorts_asc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('e767a160-59f9-4c4b-8dc1-72124a68640a')
     def test_list_sorts_desc(self):
         self._test_list_sorts_desc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('71389852-f57b-49f2-b109-77b705e9e8af')
     def test_list_pagination(self):
         self._test_list_pagination()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('b7e153d2-37c3-48d4-8390-ec13498fee3d')
     def test_list_pagination_with_marker(self):
         self._test_list_pagination_with_marker()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('8a9c89df-0ee7-4c0d-8f1d-ec8f27cf362f')
     def test_list_pagination_with_href_links(self):
         self._test_list_pagination_with_href_links()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('79a52810-2156-4ab6-b577-9e46e58d4b58')
     def test_list_pagination_page_reverse_asc(self):
         self._test_list_pagination_page_reverse_asc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('36a4671f-a542-442f-bc44-a8873ee778d1')
     def test_list_pagination_page_reverse_desc(self):
         self._test_list_pagination_page_reverse_desc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('13eb066c-aa90-406d-b4c3-39595bf8f910')
     def test_list_pagination_page_reverse_with_href_links(self):
         self._test_list_pagination_page_reverse_with_href_links()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('f1867fc5-e1d6-431f-bc9f-8b882e43a7f9')
     def test_list_no_pagination_limit_0(self):
         self._test_list_no_pagination_limit_0()
diff --git a/neutron/tests/tempest/api/test_ports.py b/neutron/tests/tempest/api/test_ports.py
index eec97ba..916f549 100644
--- a/neutron/tests/tempest/api/test_ports.py
+++ b/neutron/tests/tempest/api/test_ports.py
@@ -59,47 +59,38 @@
         for name in cls.resource_names:
             cls.create_port(net, name=name)
 
-    @test.attr(type='smoke')
     @test.idempotent_id('9ab73df4-960a-4ae3-87d3-60992b8d3e2d')
     def test_list_sorts_asc(self):
         self._test_list_sorts_asc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('b426671d-7270-430f-82ff-8f33eec93010')
     def test_list_sorts_desc(self):
         self._test_list_sorts_desc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('a202fdc8-6616-45df-b6a0-463932de6f94')
     def test_list_pagination(self):
         self._test_list_pagination()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('f4723b8e-8186-4b9a-bf9e-57519967e048')
     def test_list_pagination_with_marker(self):
         self._test_list_pagination_with_marker()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('fcd02a7a-f07e-4d5e-b0ca-b58e48927a9b')
     def test_list_pagination_with_href_links(self):
         self._test_list_pagination_with_href_links()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('3afe7024-77ab-4cfe-824b-0b2bf4217727')
     def test_list_no_pagination_limit_0(self):
         self._test_list_no_pagination_limit_0()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('b8857391-dc44-40cc-89b7-2800402e03ce')
     def test_list_pagination_page_reverse_asc(self):
         self._test_list_pagination_page_reverse_asc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('4e51e9c9-ceae-4ec0-afd4-147569247699')
     def test_list_pagination_page_reverse_desc(self):
         self._test_list_pagination_page_reverse_desc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('74293e59-d794-4a93-be09-38667199ef68')
     def test_list_pagination_page_reverse_with_href_links(self):
         self._test_list_pagination_page_reverse_with_href_links()
diff --git a/neutron/tests/tempest/api/test_qos.py b/neutron/tests/tempest/api/test_qos.py
index 6c6a95a..313715d 100644
--- a/neutron/tests/tempest/api/test_qos.py
+++ b/neutron/tests/tempest/api/test_qos.py
@@ -737,7 +737,7 @@
         policy_rules = retrieved_policy['policy']['rules']
         self.assertEqual(1, len(policy_rules))
         self.assertEqual(rule['id'], policy_rules[0]['id'])
-        self.assertEqual(qos_consts.RULE_TYPE_DSCP_MARK,
+        self.assertEqual(qos_consts.RULE_TYPE_DSCP_MARKING,
                          policy_rules[0]['type'])
 
     @test.idempotent_id('08553ffe-030f-4037-b486-7e0b8fb9385a')
diff --git a/neutron/tests/tempest/api/test_revisions.py b/neutron/tests/tempest/api/test_revisions.py
new file mode 100644
index 0000000..92f7866
--- /dev/null
+++ b/neutron/tests/tempest/api/test_revisions.py
@@ -0,0 +1,136 @@
+#    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 import test
+
+from neutron.tests.tempest.api import base
+from neutron.tests.tempest.api import base_security_groups as bsg
+from neutron.tests.tempest import config
+
+
+class TestRevisions(base.BaseAdminNetworkTest, bsg.BaseSecGroupTest):
+
+    @classmethod
+    @test.requires_ext(extension="revisions", service="network")
+    def skip_checks(cls):
+        super(TestRevisions, cls).skip_checks()
+
+    @test.idempotent_id('4a26a4be-9c53-483c-bc50-b53f1db10ac6')
+    def test_update_network_bumps_revision(self):
+        net = self.create_network()
+        self.assertIn('revision', net)
+        updated = self.client.update_network(net['id'], name='newnet')
+        self.assertGreater(updated['network']['revision'], net['revision'])
+
+    @test.idempotent_id('cac7ecde-12d5-4331-9a03-420899dea077')
+    def test_update_port_bumps_revision(self):
+        net = self.create_network()
+        port = self.create_port(net)
+        self.assertIn('revision', port)
+        updated = self.client.update_port(port['id'], name='newport')
+        self.assertGreater(updated['port']['revision'], port['revision'])
+
+    @test.idempotent_id('c1c4fa41-8e89-44d0-9bfc-409f3b66dc57')
+    def test_update_subnet_bumps_revision(self):
+        net = self.create_network()
+        subnet = self.create_subnet(net)
+        self.assertIn('revision', subnet)
+        updated = self.client.update_subnet(subnet['id'], name='newsub')
+        self.assertGreater(updated['subnet']['revision'], subnet['revision'])
+
+    @test.idempotent_id('e8c5d7db-2b8d-4615-a476-6e537437c4f2')
+    def test_update_subnetpool_bumps_revision(self):
+        sp = self.create_subnetpool('subnetpool', default_prefixlen=24,
+                                    prefixes=['10.0.0.0/8'])
+        self.assertIn('revision', sp)
+        updated = self.admin_client.update_subnetpool(sp['id'], name='sp2')
+        self.assertGreater(updated['subnetpool']['revision'], sp['revision'])
+
+    @test.idempotent_id('6c256f71-c929-4200-b3dc-4e1843506be5')
+    @test.requires_ext(extension="security-group", service="network")
+    def test_update_sg_group_bumps_revision(self):
+        sg, name = self._create_security_group()
+        self.assertIn('revision', sg['security_group'])
+        update_body = self.client.update_security_group(
+            sg['security_group']['id'], name='new_sg_name')
+        self.assertGreater(update_body['security_group']['revision'],
+                           sg['security_group']['revision'])
+
+    @test.idempotent_id('6489632f-8550-4453-a674-c98849742967')
+    @test.requires_ext(extension="security-group", service="network")
+    def test_update_port_sg_binding_bumps_revision(self):
+        net = self.create_network()
+        port = self.create_port(net)
+        sg = self._create_security_group()[0]
+        self.client.update_port(
+            port['id'], security_groups=[sg['security_group']['id']])
+        updated = self.client.show_port(port['id'])
+        self.client.update_port(port['id'], security_groups=[])
+        # TODO(kevinbenton): these extra shows after after the update are
+        # to work around the fact that ML2 creates the result dict before
+        # commit happens if the port is unbound. The update response should
+        # be usable directly once that is fixed.
+        updated2 = self.client.show_port(port['id'])
+        self.assertGreater(updated['port']['revision'], port['revision'])
+        self.assertGreater(updated2['port']['revision'],
+                           updated['port']['revision'])
+
+    @test.idempotent_id('29c7ab2b-d1d8-425d-8cec-fcf632960f22')
+    @test.requires_ext(extension="security-group", service="network")
+    def test_update_sg_rule_bumps_sg_revision(self):
+        sg, name = self._create_security_group()
+        rule = self.client.create_security_group_rule(
+            security_group_id=sg['security_group']['id'],
+            protocol='tcp', direction='ingress', ethertype=self.ethertype,
+            port_range_min=60, port_range_max=70)
+        updated = self.client.show_security_group(sg['security_group']['id'])
+        self.assertGreater(updated['security_group']['revision'],
+                           sg['security_group']['revision'])
+        self.client.delete_security_group_rule(
+            rule['security_group_rule']['id'])
+        updated2 = self.client.show_security_group(sg['security_group']['id'])
+        self.assertGreater(updated2['security_group']['revision'],
+                           updated['security_group']['revision'])
+
+    @test.idempotent_id('4a37bde9-1975-47e0-9b8c-2c9ca36415b0')
+    @test.requires_ext(extension="router", service="network")
+    def test_update_router_bumps_revision(self):
+        subnet = self.create_subnet(self.create_network())
+        router = self.create_router(router_name='test')
+        self.assertIn('revision', router)
+        rev1 = router['revision']
+        router = self.client.update_router(router['id'],
+                                           name='test2')['router']
+        self.assertGreater(router['revision'], rev1)
+        self.create_router_interface(router['id'], subnet['id'])
+        updated = self.client.show_router(router['id'])['router']
+        self.assertGreater(updated['revision'], router['revision'])
+
+    @test.idempotent_id('9de71ebc-f5df-4cd0-80bc-60299fce3ce9')
+    @test.requires_ext(extension="router", service="network")
+    @test.requires_ext(extension="standard-attr-description",
+                       service="network")
+    def test_update_floatingip_bumps_revision(self):
+        ext_id = config.CONF.network.public_network_id
+        network = self.create_network()
+        subnet = self.create_subnet(network)
+        router = self.create_router('test', external_network_id=ext_id)
+        self.create_router_interface(router['id'], subnet['id'])
+        port = self.create_port(network)
+        body = self.client.create_floatingip(
+            floating_network_id=ext_id,
+            port_id=port['id'],
+            description='d1'
+        )['floatingip']
+        self.assertIn('revision', body)
+        b2 = self.client.update_floatingip(body['id'], description='d2')
+        self.assertGreater(b2['floatingip']['revision'], body['revision'])
diff --git a/neutron/tests/tempest/api/test_routers.py b/neutron/tests/tempest/api/test_routers.py
index 7d08edd..20e54cf 100644
--- a/neutron/tests/tempest/api/test_routers.py
+++ b/neutron/tests/tempest/api/test_routers.py
@@ -274,47 +274,38 @@
         for name in cls.resource_names:
             cls.create_router(router_name=name)
 
-    @test.attr(type='smoke')
     @test.idempotent_id('03a69efb-90a7-435b-bb5c-3add3612085a')
     def test_list_sorts_asc(self):
         self._test_list_sorts_asc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('95913d30-ff41-4b17-9f44-5258c651e78c')
     def test_list_sorts_desc(self):
         self._test_list_sorts_desc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('7f7d40b1-e165-4817-8dc5-02f8e2f0dff3')
     def test_list_pagination(self):
         self._test_list_pagination()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('a5b83e83-3d98-45bb-a2c7-0ee179ffd42c')
     def test_list_pagination_with_marker(self):
         self._test_list_pagination_with_marker()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('40804af8-c25d-45f8-b8a8-b4c70345215d')
     def test_list_pagination_with_href_links(self):
         self._test_list_pagination_with_href_links()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('77b9676c-d3cb-43af-a0e8-a5b8c6099e70')
     def test_list_pagination_page_reverse_asc(self):
         self._test_list_pagination_page_reverse_asc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('3133a2c5-1bb9-4fc7-833e-cf9a1d160255')
     def test_list_pagination_page_reverse_desc(self):
         self._test_list_pagination_page_reverse_desc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('8252e2f0-b3da-4738-8e25-f6f8d878a2da')
     def test_list_pagination_page_reverse_with_href_links(self):
         self._test_list_pagination_page_reverse_with_href_links()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('fb102124-20f8-4cb3-8c81-f16f5e41d192')
     def test_list_no_pagination_limit_0(self):
         self._test_list_no_pagination_limit_0()
diff --git a/neutron/tests/tempest/api/test_routers_negative.py b/neutron/tests/tempest/api/test_routers_negative.py
index 6a028db..309b6fd 100644
--- a/neutron/tests/tempest/api/test_routers_negative.py
+++ b/neutron/tests/tempest/api/test_routers_negative.py
@@ -24,6 +24,11 @@
 class RoutersNegativeTestBase(base.BaseRouterTest):
 
     @classmethod
+    @test.requires_ext(extension="router", service="network")
+    def skip_checks(cls):
+        super(RoutersNegativeTestBase, cls).skip_checks()
+
+    @classmethod
     def resource_setup(cls):
         super(RoutersNegativeTestBase, cls).resource_setup()
         cls.router = cls.create_router(data_utils.rand_name('router'))
@@ -33,11 +38,6 @@
 
 class RoutersNegativeTest(RoutersNegativeTestBase):
 
-    @classmethod
-    @test.requires_ext(extension="router", service="network")
-    def skip_checks(cls):
-        super(RoutersNegativeTest, cls).skip_checks()
-
     @test.attr(type='negative')
     @test.idempotent_id('e3e751af-15a2-49cc-b214-a7154579e94f')
     def test_delete_router_in_use(self):
@@ -49,6 +49,28 @@
             self.client.delete_router(self.router['id'])
 
 
+class RoutersNegativePolicyTest(RoutersNegativeTestBase):
+
+    credentials = ['admin', 'primary', 'alt']
+
+    @test.attr(type='negative')
+    @test.idempotent_id('159f576d-a423-46b5-b501-622694c02f6b')
+    def test_add_interface_wrong_tenant(self):
+        client2 = self.alt_manager.network_client
+        network = client2.create_network()['network']
+        self.addCleanup(client2.delete_network, network['id'])
+        subnet = self.create_subnet(network, client=client2)
+        # This port is deleted after a test by remove_router_interface.
+        port = client2.create_port(network_id=network['id'])['port']
+        self.addCleanup(client2.delete_port, port['id'])
+        with testtools.ExpectedException(lib_exc.NotFound):
+            client2.add_router_interface_with_port_id(
+                self.router['id'], port['id'])
+        with testtools.ExpectedException(lib_exc.NotFound):
+            client2.add_router_interface_with_subnet_id(
+                self.router['id'], subnet['id'])
+
+
 class DvrRoutersNegativeTest(RoutersNegativeTestBase):
 
     @classmethod
diff --git a/neutron/tests/tempest/api/test_subnetpools.py b/neutron/tests/tempest/api/test_subnetpools.py
index 52fe787..5bd222f 100644
--- a/neutron/tests/tempest/api/test_subnetpools.py
+++ b/neutron/tests/tempest/api/test_subnetpools.py
@@ -355,47 +355,38 @@
         for name in cls.resource_names:
             cls._create_subnetpool(name=name)
 
-    @test.attr(type='smoke')
     @test.idempotent_id('6e3f842e-6bfb-49cb-82d3-0026be4e8e04')
     def test_list_sorts_asc(self):
         self._test_list_sorts_asc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('f336859b-b868-438c-a6fc-2c06374115f2')
     def test_list_sorts_desc(self):
         self._test_list_sorts_desc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('1291fae7-c196-4372-ad59-ce7988518f7b')
     def test_list_pagination(self):
         self._test_list_pagination()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('ddb20d14-1952-49b4-a17e-231cc2239a52')
     def test_list_pagination_with_marker(self):
         self._test_list_pagination_with_marker()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('b3bd9665-2769-4a43-b50c-31b1add12891')
     def test_list_pagination_with_href_links(self):
         self._test_list_pagination_with_href_links()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('1ec1f325-43b0-406e-96ce-20539e38a61d')
     def test_list_pagination_page_reverse_asc(self):
         self._test_list_pagination_page_reverse_asc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('f43a293e-4aaa-48f4-aeaf-de63a676357c')
     def test_list_pagination_page_reverse_desc(self):
         self._test_list_pagination_page_reverse_desc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('73511385-839c-4829-8ac1-b5ad992126c4')
     def test_list_pagination_page_reverse_with_href_links(self):
         self._test_list_pagination_page_reverse_with_href_links()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('82a13efc-c18f-4249-b8ec-cec7cf26fbd6')
     def test_list_no_pagination_limit_0(self):
         self._test_list_no_pagination_limit_0()
diff --git a/neutron/tests/tempest/api/test_subnets.py b/neutron/tests/tempest/api/test_subnets.py
index ba1bd61..a3a2e00 100644
--- a/neutron/tests/tempest/api/test_subnets.py
+++ b/neutron/tests/tempest/api/test_subnets.py
@@ -28,47 +28,38 @@
         for name in cls.resource_names:
             cls.create_subnet(net, name=name)
 
-    @test.attr(type='smoke')
     @test.idempotent_id('d2d61995-5dd5-4b93-bce7-3edefdb79563')
     def test_list_sorts_asc(self):
         self._test_list_sorts_asc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('c3c6b0af-c4ac-4da0-b568-8d08ae550604')
     def test_list_sorts_desc(self):
         self._test_list_sorts_desc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('b93063b3-f713-406e-bf93-e5738e09153c')
     def test_list_pagination(self):
         self._test_list_pagination()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('2ddd9aa6-de28-410f-9cbc-ce752893c407')
     def test_list_pagination_with_marker(self):
         self._test_list_pagination_with_marker()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('351183ef-6ed9-4d71-a9f2-a5ac049bd7ea')
     def test_list_pagination_with_href_links(self):
         self._test_list_pagination_with_href_links()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('dfaa20ca-6d84-4f26-962f-2fee4d247cd9')
     def test_list_pagination_page_reverse_asc(self):
         self._test_list_pagination_page_reverse_asc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('40552213-3e12-4d6a-86f3-dda92f3de88c')
     def test_list_pagination_page_reverse_desc(self):
         self._test_list_pagination_page_reverse_desc()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('3cea9053-a731-4480-93ee-19b2c28a9ce4')
     def test_list_pagination_page_reverse_with_href_links(self):
         self._test_list_pagination_page_reverse_with_href_links()
 
-    @test.attr(type='smoke')
     @test.idempotent_id('d851937c-9821-4b46-9d18-43e9077ecac0')
     def test_list_no_pagination_limit_0(self):
         self._test_list_no_pagination_limit_0()
diff --git a/neutron/tests/tempest/api/test_trunk.py b/neutron/tests/tempest/api/test_trunk.py
index fb02266..c22c334 100644
--- a/neutron/tests/tempest/api/test_trunk.py
+++ b/neutron/tests/tempest/api/test_trunk.py
@@ -12,33 +12,62 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from tempest.lib.common.utils import test_utils
 from tempest.lib import exceptions as lib_exc
 from tempest import test
 
 from neutron.tests.tempest.api import base
 
 
+def trunks_cleanup(client, trunks):
+    for trunk in trunks:
+        # NOTE(armax): deleting a trunk with subports is permitted, however
+        # for testing purposes it is safer to be explicit and clean all the
+        # resources associated with the trunk beforehand.
+        subports = test_utils.call_and_ignore_notfound_exc(
+            client.get_subports, trunk['id'])
+        if subports:
+            client.remove_subports(
+                trunk['id'], subports['sub_ports'])
+        test_utils.call_and_ignore_notfound_exc(
+            client.delete_trunk, trunk['id'])
+
+
 class TrunkTestJSONBase(base.BaseAdminNetworkTest):
 
-    def _create_trunk_with_network_and_parent(self, subports):
+    extension = 'trunk'
+
+    def setUp(self):
+        self.addCleanup(self.resource_cleanup)
+        super(TrunkTestJSONBase, self).setUp()
+
+    @classmethod
+    def skip_checks(cls):
+        super(TrunkTestJSONBase, cls).skip_checks()
+        if not test.is_extension_enabled(cls.extension, 'network'):
+            msg = "%s extension not enabled." % cls.extension
+            raise cls.skipException(msg)
+
+    @classmethod
+    def resource_setup(cls):
+        super(TrunkTestJSONBase, cls).resource_setup()
+        cls.trunks = []
+
+    @classmethod
+    def resource_cleanup(cls):
+        trunks_cleanup(cls.client, cls.trunks)
+        super(TrunkTestJSONBase, cls).resource_cleanup()
+
+    def _create_trunk_with_network_and_parent(self, subports, **kwargs):
         network = self.create_network()
         parent_port = self.create_port(network)
-        return self.client.create_trunk(parent_port['id'], subports)
+        trunk = self.client.create_trunk(parent_port['id'], subports, **kwargs)
+        self.trunks.append(trunk['trunk'])
+        return trunk
 
 
 class TrunkTestJSON(TrunkTestJSONBase):
 
-    @classmethod
-    @test.requires_ext(extension="trunk", service="network")
-    def resource_setup(cls):
-        super(TrunkTestJSON, cls).resource_setup()
-
-    def tearDown(self):
-        # NOTE(tidwellr) These tests create networks and ports, clean them up
-        # after each test to avoid hitting quota limits
-        self.resource_cleanup()
-        super(TrunkTestJSON, self).tearDown()
-
     @test.idempotent_id('e1a6355c-4768-41f3-9bf8-0f1d192bd501')
     def test_create_trunk_empty_subports_list(self):
         trunk = self._create_trunk_with_network_and_parent([])
@@ -62,6 +91,20 @@
         self.client.delete_trunk(trunk_id)
         self.assertRaises(lib_exc.NotFound, self.client.show_trunk, trunk_id)
 
+    @test.idempotent_id('4ce46c22-a2b6-4659-bc5a-0ef2463cab32')
+    def test_create_update_trunk(self):
+        trunk = self._create_trunk_with_network_and_parent(None)
+        trunk_id = trunk['trunk']['id']
+        res = self.client.show_trunk(trunk_id)
+        self.assertTrue(res['trunk']['admin_state_up'])
+        self.assertEqual("", res['trunk']['name'])
+        res = self.client.update_trunk(
+            trunk_id, name='foo', admin_state_up=False)
+        self.assertFalse(res['trunk']['admin_state_up'])
+        self.assertEqual("foo", res['trunk']['name'])
+        # enable the trunk so that it can be managed
+        self.client.update_trunk(trunk_id, admin_state_up=True)
+
     @test.idempotent_id('73365f73-bed6-42cd-960b-ec04e0c99d85')
     def test_list_trunks(self):
         trunk1 = self._create_trunk_with_network_and_parent(None)
@@ -89,6 +132,16 @@
         created_subport = observed_subports[0]
         self.assertEqual(subports[0], created_subport)
 
+    @test.idempotent_id('ee5fcead-1abf-483a-bce6-43d1e06d6aa0')
+    def test_delete_trunk_with_subport_is_allowed(self):
+        network = self.create_network()
+        port = self.create_port(network)
+        subports = [{'port_id': port['id'],
+                     'segmentation_type': 'vlan',
+                     'segmentation_id': 2}]
+        trunk = self._create_trunk_with_network_and_parent(subports)
+        self.client.delete_trunk(trunk['trunk']['id'])
+
     @test.idempotent_id('96eea398-a03c-4c3e-a99e-864392c2ca53')
     def test_remove_subport(self):
         subport_parent1 = self.create_port(self.create_network())
@@ -136,16 +189,28 @@
 class TrunksSearchCriteriaTest(base.BaseSearchCriteriaTest):
 
     resource = 'trunk'
-    field = 'id'
 
     @classmethod
-    @test.requires_ext(extension="trunk", service="network")
+    def skip_checks(cls):
+        super(TrunksSearchCriteriaTest, cls).skip_checks()
+        if not test.is_extension_enabled('trunk', 'network'):
+            msg = "trunk extension not enabled."
+            raise cls.skipException(msg)
+
+    @classmethod
     def resource_setup(cls):
         super(TrunksSearchCriteriaTest, cls).resource_setup()
+        cls.trunks = []
         net = cls.create_network(network_name='trunk-search-test-net')
         for name in cls.resource_names:
             parent_port = cls.create_port(net)
-            cls.client.create_trunk(parent_port['id'], [])
+            trunk = cls.client.create_trunk(parent_port['id'], [], name=name)
+            cls.trunks.append(trunk['trunk'])
+
+    @classmethod
+    def resource_cleanup(cls):
+        trunks_cleanup(cls.client, cls.trunks)
+        super(TrunksSearchCriteriaTest, cls).resource_cleanup()
 
     @test.idempotent_id('fab73df4-960a-4ae3-87d3-60992b8d3e2d')
     def test_list_sorts_asc(self):
diff --git a/neutron/tests/tempest/api/test_trunk_details.py b/neutron/tests/tempest/api/test_trunk_details.py
new file mode 100644
index 0000000..4b7ec28
--- /dev/null
+++ b/neutron/tests/tempest/api/test_trunk_details.py
@@ -0,0 +1,57 @@
+# Copyright 2016 Hewlett Packard Enterprise Development Company LP
+#
+#    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 import test
+
+from neutron.tests.tempest.api import test_trunk
+
+
+class TestTrunkDetailsJSON(test_trunk.TrunkTestJSONBase):
+
+    extension = 'trunk-details'
+
+    @test.idempotent_id('f0bed24f-d36a-498b-b4e7-0d66e3fb7308')
+    def test_port_resource_trunk_details_no_subports(self):
+        trunk = self._create_trunk_with_network_and_parent([])
+        port = self.client.show_port(trunk['trunk']['port_id'])
+        expected_trunk_details = {'sub_ports': [],
+                                  'trunk_id': trunk['trunk']['id']}
+        observed_trunk_details = port['port'].get('trunk_details')
+        self.assertIsNotNone(observed_trunk_details)
+        self.assertEqual(expected_trunk_details,
+                         observed_trunk_details)
+
+    @test.idempotent_id('544bcaf2-86fb-4930-93ab-ece1c3cc33df')
+    def test_port_resource_trunk_details_with_subport(self):
+        subport_network = self.create_network()
+        parent_port = self.create_port(subport_network)
+        subport_data = {'port_id': parent_port['id'],
+                        'segmentation_type': 'vlan',
+                        'segmentation_id': 2}
+        trunk = self._create_trunk_with_network_and_parent([subport_data])
+        port = self.client.show_port(trunk['trunk']['port_id'])
+        expected_trunk_details = {'sub_ports': [subport_data],
+                                  'trunk_id': trunk['trunk']['id']}
+        observed_trunk_details = port['port'].get('trunk_details')
+        self.assertIsNotNone(observed_trunk_details)
+        self.assertEqual(expected_trunk_details,
+                         observed_trunk_details)
+
+    @test.idempotent_id('fe6d865f-1d5c-432e-b65d-904157172f24')
+    def test_port_resource_empty_trunk_details(self):
+        network = self.create_network()
+        port = self.create_port(network)
+        port = self.client.show_port(port['id'])
+        observed_trunk_details = port['port'].get('trunk_details')
+        self.assertIsNone(observed_trunk_details)
diff --git a/neutron/tests/tempest/api/test_trunk_negative.py b/neutron/tests/tempest/api/test_trunk_negative.py
index 1cf37b7..654b497 100644
--- a/neutron/tests/tempest/api/test_trunk_negative.py
+++ b/neutron/tests/tempest/api/test_trunk_negative.py
@@ -21,17 +21,6 @@
 
 class TrunkTestJSON(test_trunk.TrunkTestJSONBase):
 
-    def tearDown(self):
-        # NOTE(tidwellr) These tests create networks and ports, clean them up
-        # after each test to avoid hitting quota limits
-        self.resource_cleanup()
-        super(TrunkTestJSON, self).tearDown()
-
-    @classmethod
-    @test.requires_ext(extension="trunk", service="network")
-    def resource_setup(cls):
-        super(test_trunk.TrunkTestJSONBase, cls).resource_setup()
-
     @test.attr(type='negative')
     @test.idempotent_id('1b5cf87a-1d3a-4a94-ba64-647153d54f32')
     def test_create_trunk_nonexistent_port_id(self):
@@ -139,6 +128,45 @@
                             'segmentation_id': 2}])
 
     @test.attr(type='negative')
+    @test.idempotent_id('7f132ccc-1380-42d8-9c44-50411612bd01')
+    def test_add_subport_port_id_disabled_trunk(self):
+        trunk = self._create_trunk_with_network_and_parent(
+            None, admin_state_up=False)
+        self.assertRaises(lib_exc.Conflict,
+            self.client.add_subports,
+            trunk['trunk']['id'],
+            [{'port_id': trunk['trunk']['port_id'],
+              'segmentation_type': 'vlan',
+              'segmentation_id': 2}])
+        self.client.update_trunk(
+            trunk['trunk']['id'], admin_state_up=True)
+
+    @test.attr(type='negative')
+    @test.idempotent_id('8f132ccc-1380-42d8-9c44-50411612bd01')
+    def test_remove_subport_port_id_disabled_trunk(self):
+        trunk = self._create_trunk_with_network_and_parent(
+            None, admin_state_up=False)
+        self.assertRaises(lib_exc.Conflict,
+            self.client.remove_subports,
+            trunk['trunk']['id'],
+            [{'port_id': trunk['trunk']['port_id'],
+              'segmentation_type': 'vlan',
+              'segmentation_id': 2}])
+        self.client.update_trunk(
+            trunk['trunk']['id'], admin_state_up=True)
+
+    @test.attr(type='negative')
+    @test.idempotent_id('9f132ccc-1380-42d8-9c44-50411612bd01')
+    def test_delete_trunk_disabled_trunk(self):
+        trunk = self._create_trunk_with_network_and_parent(
+            None, admin_state_up=False)
+        self.assertRaises(lib_exc.Conflict,
+            self.client.delete_trunk,
+            trunk['trunk']['id'])
+        self.client.update_trunk(
+            trunk['trunk']['id'], admin_state_up=True)
+
+    @test.attr(type='negative')
     @test.idempotent_id('00cb40bb-1593-44c8-808c-72b47e64252f')
     def test_add_subport_duplicate_segmentation_details(self):
         trunk = self._create_trunk_with_network_and_parent(None)
@@ -188,3 +216,22 @@
         trunk = self._create_trunk_with_network_and_parent([])
         self.assertRaises(lib_exc.NotFound, self.client.remove_subports,
                           trunk['trunk']['id'], [subport_data])
+
+    @test.attr(type='negative')
+    @test.idempotent_id('6c9c5126-4f61-11e6-8248-40a8f063c891')
+    def test_delete_port_in_use_by_trunk(self):
+        trunk = self._create_trunk_with_network_and_parent(None)
+        self.assertRaises(lib_exc.Conflict, self.client.delete_port,
+                          trunk['trunk']['port_id'])
+
+    @test.attr(type='negative')
+    @test.idempotent_id('343a03d0-4f7c-11e6-97fa-40a8f063c891')
+    def test_delete_port_in_use_by_subport(self):
+        network = self.create_network()
+        port = self.create_port(network)
+        subports = [{'port_id': port['id'],
+                     'segmentation_type': 'vlan',
+                     'segmentation_id': 2}]
+        self._create_trunk_with_network_and_parent(subports)
+        self.assertRaises(lib_exc.Conflict, self.client.delete_port,
+                          port['id'])
diff --git a/neutron/tests/tempest/scenario/base.py b/neutron/tests/tempest/scenario/base.py
index cf7686f..8c45f4b 100644
--- a/neutron/tests/tempest/scenario/base.py
+++ b/neutron/tests/tempest/scenario/base.py
@@ -66,7 +66,7 @@
         return body['keypair']
 
     @classmethod
-    def create_loginable_secgroup_rule(cls, secgroup_id=None):
+    def create_secgroup_rules(cls, rule_list, secgroup_id=None):
         client = cls.manager.network_client
         if not secgroup_id:
             sgs = client.list_security_groups()['security_groups']
@@ -75,18 +75,29 @@
                     secgroup_id = sg['id']
                     break
 
-        # This rule is intended to permit inbound ssh
-        # traffic from all sources, so no group_id is provided.
-        # Setting a group_id would only permit traffic from ports
-        # belonging to the same security group.
-        ruleset = {'protocol': 'tcp',
-                   'port_range_min': 22,
-                   'port_range_max': 22,
-                   'remote_ip_prefix': '0.0.0.0/0'}
-        rules = [client.create_security_group_rule(
-                     direction='ingress', security_group_id=secgroup_id,
-                     **ruleset)['security_group_rule']]
-        return rules
+        for rule in rule_list:
+            direction = rule.pop('direction')
+            client.create_security_group_rule(
+                direction=direction,
+                security_group_id=secgroup_id,
+                **rule)
+
+    @classmethod
+    def create_loginable_secgroup_rule(cls, secgroup_id=None):
+        """This rule is intended to permit inbound ssh
+
+        Allowing ssh traffic traffic from all sources, so no group_id is
+        provided.
+        Setting a group_id would only permit traffic from ports
+        belonging to the same security group.
+        """
+
+        rule_list = [{'protocol': 'tcp',
+                      'direction': 'ingress',
+                      'port_range_min': 22,
+                      'port_range_max': 22,
+                      'remote_ip_prefix': '0.0.0.0/0'}]
+        cls.create_secgroup_rules(rule_list, secgroup_id=secgroup_id)
 
     @classmethod
     def create_router_and_interface(cls, subnet_id):
@@ -109,3 +120,24 @@
     def check_connectivity(cls, host, ssh_user, ssh_key=None):
         ssh_client = ssh.Client(host, ssh_user, pkey=ssh_key)
         ssh_client.test_connection_auth()
+
+    @classmethod
+    def setup_network_and_server(cls):
+        cls.network = cls.create_network()
+        cls.subnet = cls.create_subnet(cls.network)
+
+        cls.create_router_and_interface(cls.subnet['id'])
+        cls.keypair = cls.create_keypair()
+        cls.create_loginable_secgroup_rule()
+        cls.server = cls.create_server(
+            flavor_ref=CONF.compute.flavor_ref,
+            image_ref=CONF.compute.image_ref,
+            key_name=cls.keypair['name'],
+            networks=[{'uuid': cls.network['id']}])
+        waiters.wait_for_server_status(cls.manager.servers_client,
+                                       cls.server['server']['id'],
+                                       constants.SERVER_STATUS_ACTIVE)
+        port = cls.client.list_ports(network_id=cls.network['id'],
+                                     device_id=cls.server[
+                                          'server']['id'])['ports'][0]
+        cls.fip = cls.create_and_associate_floatingip(port['id'])
diff --git a/neutron/tests/tempest/scenario/constants.py b/neutron/tests/tempest/scenario/constants.py
index bb1cab3..258c587 100644
--- a/neutron/tests/tempest/scenario/constants.py
+++ b/neutron/tests/tempest/scenario/constants.py
@@ -14,3 +14,5 @@
 
 SERVER_STATUS_ACTIVE = 'ACTIVE'
 DEFAULT_SECURITY_GROUP = 'default'
+LIMIT_KILO_BITS_PER_SECOND = 1000
+SOCKET_CONNECT_TIMEOUT = 60
diff --git a/neutron/tests/tempest/scenario/exceptions.py b/neutron/tests/tempest/scenario/exceptions.py
new file mode 100644
index 0000000..369a85b
--- /dev/null
+++ b/neutron/tests/tempest/scenario/exceptions.py
@@ -0,0 +1,33 @@
+# Copyright 2016 Red Hat, Inc.
+# All Rights Reserved.
+#
+#    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
+
+TempestException = exceptions.TempestException
+
+
+class QoSLimitReached(TempestException):
+    message = "Limit reached, limit = %(limit)d"
+
+
+class SocketConnectionRefused(TempestException):
+    message = "Unable to connect to %(host)s port %(port)d:Connection Refused"
+
+
+class ConnectionTimeoutException(TempestException):
+    message = "Timeout connecting to %(host)s port %(port)d"
+
+
+class FileCreationFailedException(TempestException):
+    message = "File %(file)s has not been created or has the wrong size"
diff --git a/neutron/tests/tempest/scenario/test_basic.py b/neutron/tests/tempest/scenario/test_basic.py
index a846591..3fd1bc6 100644
--- a/neutron/tests/tempest/scenario/test_basic.py
+++ b/neutron/tests/tempest/scenario/test_basic.py
@@ -12,12 +12,10 @@
 #    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.common import waiters
 from tempest import test
 
 from neutron.tests.tempest import config
 from neutron.tests.tempest.scenario import base
-from neutron.tests.tempest.scenario import constants
 
 CONF = config.CONF
 
@@ -31,24 +29,7 @@
 
     @test.idempotent_id('de07fe0a-e955-449e-b48b-8641c14cd52e')
     def test_basic_instance(self):
-        network = self.create_network()
-        subnet = self.create_subnet(network)
-
-        self.create_router_and_interface(subnet['id'])
-        keypair = self.create_keypair()
-        self.create_loginable_secgroup_rule()
-        server = self.create_server(
-            flavor_ref=CONF.compute.flavor_ref,
-            image_ref=CONF.compute.image_ref,
-            key_name=keypair['name'],
-            networks=[{'uuid': network['id']}])
-        waiters.wait_for_server_status(self.manager.servers_client,
-                                       server['server']['id'],
-                                       constants.SERVER_STATUS_ACTIVE)
-        port = self.client.list_ports(network_id=network['id'],
-                                      device_id=server[
-                                          'server']['id'])['ports'][0]
-        fip = self.create_and_associate_floatingip(port['id'])
-        self.check_connectivity(fip['floating_ip_address'],
+        self.setup_network_and_server()
+        self.check_connectivity(self.fip['floating_ip_address'],
                                 CONF.validation.image_ssh_user,
-                                keypair['private_key'])
+                                self.keypair['private_key'])
diff --git a/neutron/tests/tempest/scenario/test_qos.py b/neutron/tests/tempest/scenario/test_qos.py
new file mode 100644
index 0000000..89b31a7
--- /dev/null
+++ b/neutron/tests/tempest/scenario/test_qos.py
@@ -0,0 +1,184 @@
+# Copyright 2016 Red Hat, Inc.
+# All Rights Reserved.
+#
+#    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.
+import errno
+import socket
+import time
+
+from oslo_log import log as logging
+from tempest.lib.common import ssh
+from tempest.lib import exceptions
+from tempest import test
+
+from neutron.common import utils
+from neutron.tests.tempest import config
+from neutron.tests.tempest.scenario import base
+from neutron.tests.tempest.scenario import constants
+from neutron.tests.tempest.scenario import exceptions as sc_exceptions
+
+CONF = config.CONF
+LOG = logging.getLogger(__name__)
+
+
+def _try_connect(host_ip, port):
+    try:
+        client_socket = socket.socket(socket.AF_INET,
+                                      socket.SOCK_STREAM)
+        client_socket.connect((host_ip, port))
+        client_socket.setblocking(0)
+        return client_socket
+    except socket.error as serr:
+        if serr.errno == errno.ECONNREFUSED:
+            raise sc_exceptions.SocketConnectionRefused(host=host_ip,
+                                                        port=port)
+        else:
+            raise
+
+
+def _connect_socket(host, port):
+    """Try to initiate a connection to a host using an ip address
+    and a port.
+
+    Trying couple of times until a timeout is reached in case the listening
+    host is not ready yet.
+    """
+
+    start = time.time()
+    while True:
+        try:
+            return _try_connect(host, port)
+        except sc_exceptions.SocketConnectionRefused:
+            if time.time() - start > constants.SOCKET_CONNECT_TIMEOUT:
+                raise sc_exceptions.ConnectionTimeoutException(host=host,
+                                                               port=port)
+
+
+class QoSTest(base.BaseTempestTestCase):
+    credentials = ['primary', 'admin']
+    force_tenant_isolation = False
+
+    BUFFER_SIZE = 1024 * 1024
+    TOLERANCE_FACTOR = 1.5
+    BS = 512
+    COUNT = BUFFER_SIZE / BS
+    FILE_SIZE = BS * COUNT
+    LIMIT_BYTES_SEC = (constants.LIMIT_KILO_BITS_PER_SECOND * 1024
+                       * TOLERANCE_FACTOR / 8.0)
+    FILE_PATH = "/tmp/img"
+
+    @classmethod
+    @test.requires_ext(extension="qos", service="network")
+    def resource_setup(cls):
+        super(QoSTest, cls).resource_setup()
+
+    def _create_file_for_bw_tests(self, ssh_client):
+        cmd = ("(dd if=/dev/zero bs=%(bs)d count=%(count)d of=%(file_path)s) "
+               % {'bs': QoSTest.BS, 'count': QoSTest.COUNT,
+               'file_path': QoSTest.FILE_PATH})
+        ssh_client.exec_command(cmd)
+        cmd = "stat -c %%s %s" % QoSTest.FILE_PATH
+        filesize = ssh_client.exec_command(cmd)
+        if int(filesize.strip()) != QoSTest.FILE_SIZE:
+            raise sc_exceptions.FileCreationFailedException(
+                file=QoSTest.FILE_PATH)
+
+    def _check_bw(self, ssh_client, host, port):
+        total_bytes_read = 0
+        cycle_start_time = time.time()
+        cycle_data_read = 0
+
+        cmd = "killall -q nc"
+        try:
+            ssh_client.exec_command(cmd)
+        except exceptions.SSHExecCommandFailed:
+            pass
+        cmd = ("(nc -ll -p %(port)d < %(file_path)s > /dev/null &)" % {
+                'port': port, 'file_path': QoSTest.FILE_PATH})
+        ssh_client.exec_command(cmd)
+        client_socket = _connect_socket(host, port)
+
+        while total_bytes_read < QoSTest.FILE_SIZE:
+            try:
+                data = client_socket.recv(QoSTest.BUFFER_SIZE)
+            except socket.error as e:
+                if e.args[0] in [errno.EAGAIN, errno.EWOULDBLOCK]:
+                    continue
+                else:
+                    raise
+            total_bytes_read += len(data)
+            cycle_data_read += len(data)
+            time_elapsed = time.time() - cycle_start_time
+            should_check = (time_elapsed >= 5 or
+                            total_bytes_read == QoSTest.FILE_SIZE)
+            if should_check:
+                LOG.debug("time_elapsed =  %(time_elapsed)d,"
+                          "total_bytes_read = %(bytes_read)d,"
+                          "cycle_data_read = %(cycle_data)d",
+                          {"time_elapsed": time_elapsed,
+                           "bytes_read": total_bytes_read,
+                           "cycle_data": cycle_data_read})
+
+                if cycle_data_read / time_elapsed > QoSTest.LIMIT_BYTES_SEC:
+                    # Limit reached
+                    return False
+                else:
+                    cycle_start_time = time.time()
+                    cycle_data_read = 0
+        return True
+
+    @test.idempotent_id('1f7ed39b-428f-410a-bd2b-db9f465680df')
+    def test_qos(self):
+        """This is a basic test that check that a QoS policy with
+
+           a bandwidth limit rule is applied correctly by sending
+           a file from the instance to the test node.
+           Then calculating the bandwidth every ~1 sec by the number of bits
+           received / elapsed time.
+        """
+
+        NC_PORT = 1234
+
+        self.setup_network_and_server()
+        self.check_connectivity(self.fip['floating_ip_address'],
+                                CONF.validation.image_ssh_user,
+                                self.keypair['private_key'])
+        rulesets = [{'protocol': 'tcp',
+                     'direction': 'ingress',
+                     'port_range_min': NC_PORT,
+                     'port_range_max': NC_PORT,
+                     'remote_ip_prefix': '0.0.0.0/0'}]
+        self.create_secgroup_rules(rulesets)
+        ssh_client = ssh.Client(self.fip['floating_ip_address'],
+                                CONF.validation.image_ssh_user,
+                                pkey=self.keypair['private_key'])
+        policy = self.admin_manager.network_client.create_qos_policy(
+                                        name='test-policy',
+                                        description='test-qos-policy',
+                                        shared=True)
+        policy_id = policy['policy']['id']
+        self.admin_manager.network_client.create_bandwidth_limit_rule(
+            policy_id, max_kbps=constants.LIMIT_KILO_BITS_PER_SECOND,
+            max_burst_kbps=constants.LIMIT_KILO_BITS_PER_SECOND)
+        port = self.client.list_ports(network_id=self.network['id'],
+                                      device_id=self.server[
+                                      'server']['id'])['ports'][0]
+        self.admin_manager.network_client.update_port(port['id'],
+                                                      qos_policy_id=policy_id)
+        self._create_file_for_bw_tests(ssh_client)
+        utils.wait_until_true(lambda: self._check_bw(
+            ssh_client,
+            self.fip['floating_ip_address'],
+            port=NC_PORT),
+            timeout=120,
+            sleep=1)
diff --git a/neutron/tests/tempest/services/network/json/network_client.py b/neutron/tests/tempest/services/network/json/network_client.py
index 3220604..12ba685 100644
--- a/neutron/tests/tempest/services/network/json/network_client.py
+++ b/neutron/tests/tempest/services/network/json/network_client.py
@@ -659,7 +659,8 @@
         body = jsonutils.loads(body)
         return service_client.ResponseBody(resp, body)
 
-    def create_trunk(self, parent_port_id, subports, tenant_id=None):
+    def create_trunk(self, parent_port_id, subports,
+                     tenant_id=None, name=None, admin_state_up=None):
         uri = '%s/trunks' % self.uri_prefix
         post_data = {
             'trunk': {
@@ -670,11 +671,24 @@
             post_data['trunk']['sub_ports'] = subports
         if tenant_id is not None:
             post_data['trunk']['tenant_id'] = tenant_id
+        if name is not None:
+            post_data['trunk']['name'] = name
+        if admin_state_up is not None:
+            post_data['trunk']['admin_state_up'] = admin_state_up
         resp, body = self.post(uri, self.serialize(post_data))
         body = self.deserialize_single(body)
         self.expected_success(201, resp.status)
         return service_client.ResponseBody(resp, body)
 
+    def update_trunk(self, trunk_id, **kwargs):
+        put_body = {'trunk': kwargs}
+        body = jsonutils.dumps(put_body)
+        uri = '%s/trunks/%s' % (self.uri_prefix, trunk_id)
+        resp, body = self.put(uri, body)
+        self.expected_success(200, resp.status)
+        body = jsonutils.loads(body)
+        return service_client.ResponseBody(resp, body)
+
     def show_trunk(self, trunk_id):
         uri = '%s/trunks/%s' % (self.uri_prefix, trunk_id)
         resp, body = self.get(uri)
@@ -699,7 +713,7 @@
 
     def _subports_action(self, action, trunk_id, subports):
         uri = '%s/trunks/%s/%s' % (self.uri_prefix, trunk_id, action)
-        resp, body = self.put(uri, jsonutils.dumps(subports))
+        resp, body = self.put(uri, jsonutils.dumps({'sub_ports': subports}))
         body = self.deserialize_single(body)
         self.expected_success(200, resp.status)
         return service_client.ResponseBody(resp, body)