Merge "Mark NetworkMigrationFromHA scenario tests as unstable"
diff --git a/.zuul.yaml b/.zuul.yaml
index 1f8c71e..9aa86b9 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -121,7 +121,6 @@
         DEFAULT_INSTANCE_TYPE: ds512M
         DEFAULT_INSTANCE_USER: ubuntu
         BUILD_TIMEOUT: 784
-        LIBVIRT_TYPE: kvm
       devstack_services:
         cinder: true
 
@@ -243,3 +242,4 @@
       - neutron-tempest-plugin-jobs-queens
       - check-requirements
       - tempest-plugin-jobs
+      - release-notes-jobs-python3
diff --git a/README.rst b/README.rst
index b3883b8..3d8a49b 100644
--- a/README.rst
+++ b/README.rst
@@ -10,3 +10,4 @@
 * Documentation: https://docs.openstack.org/neutron/latest/
 * Source: https://git.openstack.org/cgit/openstack/neutron-tempest-plugin
 * Bugs: https://bugs.launchpad.net/neutron
+* Release notes: https://docs.openstack.org/releasenotes/neutron-tempest-plugin/
diff --git a/neutron_tempest_plugin/api/admin/test_tag.py b/neutron_tempest_plugin/api/admin/test_tag.py
index 05db644..c0210a2 100644
--- a/neutron_tempest_plugin/api/admin/test_tag.py
+++ b/neutron_tempest_plugin/api/admin/test_tag.py
@@ -212,13 +212,7 @@
     def _create_resource(cls):
         network = cls.create_network()
         parent_port = cls.create_port(network)
-        trunk = cls.client.create_trunk(parent_port['id'], None)
-        return trunk['trunk']['id']
-
-    @classmethod
-    def resource_cleanup(cls):
-        cls.client.delete_trunk(cls.res_id)
-        super(TagTrunkTestJSON, cls).resource_cleanup()
+        return cls.create_trunk(parent_port)['id']
 
     @decorators.attr(type='smoke')
     @decorators.idempotent_id('4c63708b-c4c3-407c-8101-7a9593882f5f')
@@ -467,14 +461,7 @@
     def _create_resource(cls):
         network = cls.create_network()
         parent_port = cls.create_port(network)
-        trunk = cls.client.create_trunk(parent_port['id'], None)
-        return trunk['trunk']['id']
-
-    @classmethod
-    def resource_cleanup(cls):
-        for res_id in cls.res_ids:
-            cls.client.delete_trunk(res_id)
-        super(TagFilterTrunkTestJSON, cls).resource_cleanup()
+        return cls.create_trunk(parent_port)['id']
 
     def _list_resource(self, filters):
         res = self.client.list_trunks(**filters)
diff --git a/neutron_tempest_plugin/api/test_trunk.py b/neutron_tempest_plugin/api/test_trunk.py
index 1a000fd..823a95d 100644
--- a/neutron_tempest_plugin/api/test_trunk.py
+++ b/neutron_tempest_plugin/api/test_trunk.py
@@ -14,7 +14,6 @@
 
 from tempest.common import utils
 from tempest.lib.common.utils import data_utils
-from tempest.lib.common.utils import test_utils
 from tempest.lib import decorators
 from tempest.lib import exceptions as lib_exc
 
@@ -22,18 +21,7 @@
 from neutron_tempest_plugin import config
 
 
-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'])
+CONF = config.CONF
 
 
 class TrunkTestJSONBase(base.BaseAdminNetworkTest):
@@ -41,51 +29,51 @@
     required_extensions = ['trunk']
 
     def setUp(self):
+        base.BaseAdminNetworkTest.setUp(self)
+        # This avoids problems due to user quotas
+        self.resource_setup()
         self.addCleanup(self.resource_cleanup)
-        super(TrunkTestJSONBase, self).setUp()
-
-    @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()
 
     @classmethod
     def is_type_driver_enabled(cls, type_driver):
         return (type_driver in
-                config.CONF.neutron_plugin_options.available_type_drivers)
+                CONF.neutron_plugin_options.available_type_drivers)
 
-    def _create_trunk_with_network_and_parent(
-            self, subports, parent_network_type=None, **kwargs):
+    @classmethod
+    def _create_trunk_with_network_and_parent(cls, subports=None,
+                                              parent_network_type=None,
+                                              **kwargs):
         client = None
         network_kwargs = {}
         if parent_network_type:
-            client = self.admin_client
+            client = cls.admin_client
             network_kwargs = {"provider:network_type": parent_network_type,
-                              "tenant_id": self.client.tenant_id}
-        network = self.create_network(client=client, **network_kwargs)
-        parent_port = self.create_port(network)
-        trunk = self.client.create_trunk(parent_port['id'], subports, **kwargs)
-        self.trunks.append(trunk['trunk'])
-        return trunk
+                              "tenant_id": cls.client.tenant_id}
+        network = cls.create_network(client=client, **network_kwargs)
+        parent_port = cls.create_port(network)
+        return cls.create_trunk(parent_port, subports, **kwargs)
 
-    def _show_trunk(self, trunk_id):
-        return self.client.show_trunk(trunk_id)
+    @classmethod
+    def _show_trunk(cls, trunk):
+        client = trunk.get('client') or cls.client
+        return client.show_trunk(trunk['id'])['trunk']
 
-    def _list_trunks(self):
-        return self.client.list_trunks()
+    @classmethod
+    def _update_trunk(cls, trunk, **kwargs):
+        client = trunk.get('client') or cls.client
+        return client.update_trunk(trunk['id'], **kwargs)['trunk']
+
+    @classmethod
+    def _list_trunks(cls):
+        return cls.client.list_trunks()['trunks']
 
 
 class TrunkTestJSON(TrunkTestJSONBase):
 
     def _test_create_trunk(self, subports):
         trunk = self._create_trunk_with_network_and_parent(subports)
-        observed_trunk = self._show_trunk(trunk['trunk']['id'])
-        self.assertEqual(trunk, observed_trunk)
+        observed_trunk = self._show_trunk(trunk)
+        self.assertEqual(trunk, dict(observed_trunk, client=trunk['client']))
 
     @decorators.idempotent_id('e1a6355c-4768-41f3-9bf8-0f1d192bd501')
     def test_create_trunk_empty_subports_list(self):
@@ -97,79 +85,69 @@
 
     @decorators.idempotent_id('7de46c22-e2b6-4959-ac5a-0e624632ab32')
     def test_create_show_delete_trunk(self):
-        trunk = self._create_trunk_with_network_and_parent(None)
-        trunk_id = trunk['trunk']['id']
-        parent_port_id = trunk['trunk']['port_id']
-        res = self._show_trunk(trunk_id)
-        self.assertEqual(trunk_id, res['trunk']['id'])
-        self.assertEqual(parent_port_id, res['trunk']['port_id'])
-        self.client.delete_trunk(trunk_id)
-        self.assertRaises(lib_exc.NotFound, self._show_trunk, trunk_id)
+        trunk = self._create_trunk_with_network_and_parent()
+        observed_trunk = self._show_trunk(trunk)
+        self.assertEqual(trunk, dict(observed_trunk, client=trunk['client']))
+        self.delete_trunk(trunk)
+        self.assertRaises(lib_exc.NotFound, self._show_trunk, trunk)
 
     @decorators.idempotent_id('8d83a6ca-662d-45b8-8062-d513077296aa')
     @utils.requires_ext(extension="project-id", service="network")
     def test_show_trunk_has_project_id(self):
-        trunk = self._create_trunk_with_network_and_parent(None)
-        body = self._show_trunk(trunk['trunk']['id'])
-        show_trunk = body['trunk']
-        self.assertIn('project_id', show_trunk)
-        self.assertIn('tenant_id', show_trunk)
-        self.assertEqual(self.client.tenant_id, show_trunk['project_id'])
-        self.assertEqual(self.client.tenant_id, show_trunk['tenant_id'])
+        trunk = self._create_trunk_with_network_and_parent()
+        observed_trunk = self._show_trunk(trunk)
+        for key in ['project_id', 'tenant_id']:
+            self.assertIn(key, observed_trunk)
+            self.assertEqual(self.client.tenant_id, observed_trunk[key])
 
     @decorators.idempotent_id('4ce46c22-a2b6-4659-bc5a-0ef2463cab32')
     def test_create_update_trunk(self):
-        trunk = self._create_trunk_with_network_and_parent(None)
-        rev = trunk['trunk']['revision_number']
-        trunk_id = trunk['trunk']['id']
-        res = self._show_trunk(trunk_id)
-        self.assertTrue(res['trunk']['admin_state_up'])
-        self.assertEqual(rev, res['trunk']['revision_number'])
-        self.assertEqual("", res['trunk']['name'])
-        self.assertEqual("", res['trunk']['description'])
-        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'])
-        self.assertGreater(res['trunk']['revision_number'], rev)
-        # enable the trunk so that it can be managed
-        self.client.update_trunk(trunk_id, admin_state_up=True)
+        trunk = self._create_trunk_with_network_and_parent()
+        observed_trunk = self._show_trunk(trunk)
+        self.assertTrue(observed_trunk['admin_state_up'])
+        self.assertEqual(trunk['revision_number'],
+                         observed_trunk['revision_number'])
+        self.assertEqual("", observed_trunk['name'])
+        self.assertEqual("", observed_trunk['description'])
+        updated_trunk = self._update_trunk(trunk, name='foo',
+                                           admin_state_up=False)
+        self.assertFalse(updated_trunk['admin_state_up'])
+        self.assertEqual("foo", updated_trunk['name'])
+        self.assertGreater(updated_trunk['revision_number'],
+                           trunk['revision_number'])
 
     @decorators.idempotent_id('5ff46c22-a2b6-5559-bc5a-0ef2463cab32')
     def test_create_update_trunk_with_description(self):
         trunk = self._create_trunk_with_network_and_parent(
-            None, description="foo description")
-        trunk_id = trunk['trunk']['id']
-        self.assertEqual("foo description", trunk['trunk']['description'])
-        trunk = self.client.update_trunk(trunk_id, description='')
-        self.assertEqual('', trunk['trunk']['description'])
+            description="foo description")
+        self.assertEqual("foo description", trunk['description'])
+        updated_trunk = self._update_trunk(trunk, description='')
+        self.assertEqual('', updated_trunk['description'])
 
     @decorators.idempotent_id('73365f73-bed6-42cd-960b-ec04e0c99d85')
     def test_list_trunks(self):
-        trunk1 = self._create_trunk_with_network_and_parent(None)
-        trunk2 = self._create_trunk_with_network_and_parent(None)
-        expected_trunks = {trunk1['trunk']['id']: trunk1['trunk'],
-                           trunk2['trunk']['id']: trunk2['trunk']}
-        trunk_list = self._list_trunks()['trunks']
-        matched_trunks = [x for x in trunk_list if x['id'] in expected_trunks]
-        self.assertEqual(2, len(matched_trunks))
-        for trunk in matched_trunks:
-            self.assertEqual(expected_trunks[trunk['id']], trunk)
+        trunk1 = self._create_trunk_with_network_and_parent()
+        trunk2 = self._create_trunk_with_network_and_parent()
+        expected_trunks = {trunk1['id']: trunk1,
+                           trunk2['id']: trunk2}
+        observed_trunks = {trunk['id']: dict(trunk, client=self.client)
+                           for trunk in self._list_trunks()
+                           if trunk['id'] in expected_trunks}
+        self.assertEqual(expected_trunks, observed_trunks)
 
     @decorators.idempotent_id('bb5fcead-09b5-484a-bbe6-46d1e06d6cc0')
-    def test_add_subport(self):
-        trunk = self._create_trunk_with_network_and_parent([])
+    def test_add_subports(self):
+        trunk = self._create_trunk_with_network_and_parent()
         network = self.create_network()
         port = self.create_port(network)
         subports = [{'port_id': port['id'],
                      'segmentation_type': 'vlan',
                      'segmentation_id': 2}]
-        self.client.add_subports(trunk['trunk']['id'], subports)
-        trunk = self._show_trunk(trunk['trunk']['id'])
-        observed_subports = trunk['trunk']['sub_ports']
-        self.assertEqual(1, len(observed_subports))
-        created_subport = observed_subports[0]
-        self.assertEqual(subports[0], created_subport)
+        added_subports = self.client.add_subports(trunk['id'],
+                                                  subports)['sub_ports']
+        self.assertEqual(subports, added_subports)
+        observed_trunk = self._show_trunk(trunk)
+        self.assertEqual(subports, observed_trunk['sub_ports'])
 
     @decorators.idempotent_id('ee5fcead-1abf-483a-bce6-43d1e06d6aa0')
     def test_delete_trunk_with_subport_is_allowed(self):
@@ -179,38 +157,27 @@
                      'segmentation_type': 'vlan',
                      'segmentation_id': 2}]
         trunk = self._create_trunk_with_network_and_parent(subports)
-        self.client.delete_trunk(trunk['trunk']['id'])
+        self.client.delete_trunk(trunk['id'])
 
     @decorators.idempotent_id('96eea398-a03c-4c3e-a99e-864392c2ca53')
     def test_remove_subport(self):
-        subport_parent1 = self.create_port(self.create_network())
-        subport_parent2 = self.create_port(self.create_network())
-        subports = [{'port_id': subport_parent1['id'],
-                     'segmentation_type': 'vlan',
-                     'segmentation_id': 2},
-                    {'port_id': subport_parent2['id'],
-                     'segmentation_type': 'vlan',
-                     'segmentation_id': 4}]
-        trunk = self._create_trunk_with_network_and_parent(subports)
-        removed_subport = trunk['trunk']['sub_ports'][0]
-        expected_subport = None
-
-        for subport in subports:
-            if subport['port_id'] != removed_subport['port_id']:
-                expected_subport = subport
-                break
+        subport1 = {'port_id': self.create_port(self.create_network())['id'],
+                    'segmentation_type': 'vlan',
+                    'segmentation_id': 2}
+        subport2 = {'port_id': self.create_port(self.create_network())['id'],
+                    'segmentation_type': 'vlan',
+                    'segmentation_id': 4}
+        trunk = self._create_trunk_with_network_and_parent([subport1,
+                                                            subport2])
 
         # Remove the subport and validate PUT response
-        res = self.client.remove_subports(trunk['trunk']['id'],
-                                          [removed_subport])
-        self.assertEqual(1, len(res['sub_ports']))
-        self.assertEqual(expected_subport, res['sub_ports'][0])
+        subports_after_remove = self.client.remove_subports(
+            trunk['id'], [subport2])['sub_ports']
+        self.assertEqual([subport1], subports_after_remove)
 
         # Validate the results of a subport list
-        trunk = self._show_trunk(trunk['trunk']['id'])
-        observed_subports = trunk['trunk']['sub_ports']
-        self.assertEqual(1, len(observed_subports))
-        self.assertEqual(expected_subport, observed_subports[0])
+        observed_trunk = self._show_trunk(trunk)
+        self.assertEqual([subport1], observed_trunk['sub_ports'])
 
     @decorators.idempotent_id('bb5fcaad-09b5-484a-dde6-4cd1ea6d6ff0')
     def test_get_subports(self):
@@ -220,9 +187,8 @@
                      'segmentation_type': 'vlan',
                      'segmentation_id': 2}]
         trunk = self._create_trunk_with_network_and_parent(subports)
-        trunk = self.client.get_subports(trunk['trunk']['id'])
-        observed_subports = trunk['sub_ports']
-        self.assertEqual(1, len(observed_subports))
+        observed_subports = self.client.get_subports(trunk['id'])['sub_ports']
+        self.assertEqual(subports, observed_subports)
 
 
 class TrunkTestInheritJSONBase(TrunkTestJSONBase):
@@ -233,41 +199,43 @@
     def skip_checks(cls):
         super(TrunkTestInheritJSONBase, cls).skip_checks()
         if ("vlan" not in
-                config.CONF.neutron_plugin_options.available_type_drivers):
+                CONF.neutron_plugin_options.available_type_drivers):
             raise cls.skipException("VLAN type_driver is not enabled")
-        if not config.CONF.neutron_plugin_options.provider_vlans:
+        if not CONF.neutron_plugin_options.provider_vlans:
             raise cls.skipException("No provider VLAN networks available")
 
     def create_provider_network(self):
-        foo_net = config.CONF.neutron_plugin_options.provider_vlans[0]
+        foo_net = CONF.neutron_plugin_options.provider_vlans[0]
         return self.create_network(name=data_utils.rand_name('vlan-net'),
                                    provider_network_type='vlan',
                                    provider_physical_network=foo_net)
 
     @decorators.idempotent_id('0f05d98e-41f5-4629-dada-9aee269c9602')
     def test_add_subport(self):
-        trunk_network = self.create_provider_network()
-        trunk_port = self.create_port(trunk_network)
-        subport_networks = [
-            self.create_provider_network(),
-            self.create_provider_network(),
-        ]
-        subport1 = self.create_port(subport_networks[0])
-        subport2 = self.create_port(subport_networks[1])
+        parent_network = self.create_provider_network()
+        parent_port = self.create_port(parent_network)
+        subport_network1 = self.create_provider_network()
+        segmentation_id1 = subport_network1['provider:segmentation_id']
+        subport_network2 = self.create_provider_network()
+        segmentation_id2 = subport_network2['provider:segmentation_id']
+        subport1 = self.create_port(subport_network1)
+        subport2 = self.create_port(subport_network2)
         subports = [{'port_id': subport1['id'],
-                     'segmentation_type': 'inherit',
-                     'segmentation_id': subport1['id']},
+                     'segmentation_type': 'inherit'},
                     {'port_id': subport2['id'],
-                     'segmentation_type': 'inherit',
-                     'segmentation_id': subport2['id']}]
-        trunk = self.client.create_trunk(trunk_port['id'], subports)['trunk']
-        self.trunks.append(trunk)
+                     'segmentation_type': 'inherit'}]
+
+        trunk = self.create_trunk(parent_port, subports)
+
+        expected_subports = [{'port_id': subport1['id'],
+                              'segmentation_type': 'vlan',
+                              'segmentation_id': segmentation_id1},
+                             {'port_id': subport2['id'],
+                              'segmentation_type': 'vlan',
+                              'segmentation_id': segmentation_id2}]
+
         # Validate that subport got segmentation details from the network
-        for i in range(2):
-            self.assertEqual(subport_networks[i]['provider:network_type'],
-                             trunk['sub_ports'][i]['segmentation_type'])
-            self.assertEqual(subport_networks[i]['provider:segmentation_id'],
-                             trunk['sub_ports'][i]['segmentation_id'])
+        self.assertEqual(expected_subports, trunk['sub_ports'])
 
 
 class TrunkTestMtusJSONBase(TrunkTestJSONBase):
@@ -306,19 +274,16 @@
                      'segmentation_type': 'vlan',
                      'segmentation_id': 2}]
 
-        trunk = self.client.create_trunk(self.larger_mtu_port['id'], subports)
-        self.trunks.append(trunk['trunk'])
+        self.create_trunk(self.larger_mtu_port, subports)
 
     @decorators.idempotent_id('2004c5c6-e557-4c43-8100-c820ad4953e8')
-    def test_add_subport_with_mtu_smaller_than_trunk(self):
+    def test_add_subport_with_mtu_greater_than_subport(self):
         subports = [{'port_id': self.smaller_mtu_port['id'],
                      'segmentation_type': 'vlan',
                      'segmentation_id': 2}]
 
-        trunk = self.client.create_trunk(self.larger_mtu_port['id'], None)
-        self.trunks.append(trunk['trunk'])
-
-        self.client.add_subports(trunk['trunk']['id'], subports)
+        trunk = self.create_trunk(self.larger_mtu_port)
+        self.client.add_subports(trunk['id'], subports)
 
     @decorators.idempotent_id('22725101-f4bc-4e00-84ec-4e02cd7e0500')
     def test_create_trunk_with_mtu_equal_to_subport(self):
@@ -326,9 +291,7 @@
                      'segmentation_type': 'vlan',
                      'segmentation_id': 2}]
 
-        trunk = self.client.create_trunk(self.smaller_mtu_port_2['id'],
-                                         subports)
-        self.trunks.append(trunk['trunk'])
+        self.create_trunk(self.smaller_mtu_port_2, subports)
 
     @decorators.idempotent_id('175b05ae-66ad-44c7-857a-a12d16f1058f')
     def test_add_subport_with_mtu_equal_to_trunk(self):
@@ -336,10 +299,8 @@
                      'segmentation_type': 'vlan',
                      'segmentation_id': 2}]
 
-        trunk = self.client.create_trunk(self.smaller_mtu_port_2['id'], None)
-        self.trunks.append(trunk['trunk'])
-
-        self.client.add_subports(trunk['trunk']['id'], subports)
+        trunk = self.create_trunk(self.smaller_mtu_port_2)
+        self.client.add_subports(trunk['id'], subports)
 
 
 class TrunksSearchCriteriaTest(base.BaseSearchCriteriaTest):
@@ -350,17 +311,10 @@
     @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)
-            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()
+            cls.create_trunk(parent_port, name=name)
 
     @decorators.idempotent_id('fab73df4-960a-4ae3-87d3-60992b8d3e2d')
     def test_list_sorts_asc(self):
diff --git a/neutron_tempest_plugin/api/test_trunk_details.py b/neutron_tempest_plugin/api/test_trunk_details.py
index 972f216..bc8a2ea 100644
--- a/neutron_tempest_plugin/api/test_trunk_details.py
+++ b/neutron_tempest_plugin/api/test_trunk_details.py
@@ -23,14 +23,13 @@
 
     @decorators.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'])
+        trunk = self._create_trunk_with_network_and_parent()
+        parent_port = self.client.show_port(trunk['port_id'])['port']
+        observed_trunk_details = parent_port.get('trunk_details')
         expected_trunk_details = {'sub_ports': [],
-                                  'trunk_id': trunk['trunk']['id']}
-        observed_trunk_details = port['port'].get('trunk_details')
+                                  'trunk_id': trunk['id']}
         self.assertIsNotNone(observed_trunk_details)
-        self.assertEqual(expected_trunk_details,
-                         observed_trunk_details)
+        self.assertEqual(expected_trunk_details, observed_trunk_details)
 
     @decorators.idempotent_id('544bcaf2-86fb-4930-93ab-ece1c3cc33df')
     def test_port_resource_trunk_details_with_subport(self):
@@ -40,19 +39,19 @@
                         'segmentation_type': 'vlan',
                         'segmentation_id': 2}
         trunk = self._create_trunk_with_network_and_parent([subport_data])
-        subport_data['mac_address'] = subport['mac_address']
-        parent_port = self.client.show_port(trunk['trunk']['port_id'])
-        expected_trunk_details = {'sub_ports': [subport_data],
-                                  'trunk_id': trunk['trunk']['id']}
-        observed_trunk_details = parent_port['port'].get('trunk_details')
+        parent_port = self.client.show_port(trunk['port_id'])['port']
+        observed_trunk_details = parent_port.get('trunk_details')
+        expected_subport_data = dict(subport_data,
+                                     mac_address=subport['mac_address'])
+        expected_trunk_details = {'sub_ports': [expected_subport_data],
+                                  'trunk_id': trunk['id']}
         self.assertIsNotNone(observed_trunk_details)
-        self.assertEqual(expected_trunk_details,
-                         observed_trunk_details)
+        self.assertEqual(expected_trunk_details, observed_trunk_details)
 
     @decorators.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')
+        observed_port = self.client.show_port(port['id'])['port']
+        observed_trunk_details = observed_port.get('trunk_details')
         self.assertIsNone(observed_trunk_details)
diff --git a/neutron_tempest_plugin/api/test_trunk_negative.py b/neutron_tempest_plugin/api/test_trunk_negative.py
index 4d7ead1..85beb4e 100644
--- a/neutron_tempest_plugin/api/test_trunk_negative.py
+++ b/neutron_tempest_plugin/api/test_trunk_negative.py
@@ -19,6 +19,9 @@
 import testtools
 
 from neutron_tempest_plugin.api import test_trunk
+from neutron_tempest_plugin import config
+
+CONF = config.CONF
 
 
 class TrunkTestJSON(test_trunk.TrunkTestJSONBase):
@@ -43,9 +46,9 @@
     @decorators.attr(type='negative')
     @decorators.idempotent_id('a5c5200a-72a0-43c5-a11a-52f808490344')
     def test_create_subport_nonexistent_port_id(self):
-        trunk = self._create_trunk_with_network_and_parent([])
+        trunk = self._create_trunk_with_network_and_parent()
         self.assertRaises(lib_exc.NotFound, self.client.add_subports,
-                          trunk['trunk']['id'],
+                          trunk['id'],
                           [{'port_id': uuidutils.generate_uuid(),
                             'segmentation_type': 'vlan',
                             'segmentation_id': 2}])
@@ -64,11 +67,11 @@
     @decorators.attr(type='negative')
     @decorators.idempotent_id('7e0f99ab-fe37-408b-a889-9e44ef300084')
     def test_create_subport_missing_segmentation_id(self):
-        trunk = self._create_trunk_with_network_and_parent([])
+        trunk = self._create_trunk_with_network_and_parent()
         subport_network = self.create_network()
         parent_port = self.create_port(subport_network)
         self.assertRaises(lib_exc.BadRequest, self.client.add_subports,
-                          trunk['trunk']['id'],
+                          trunk['id'],
                           [{'port_id': parent_port['id'],
                             'segmentation_type': 'vlan'}])
 
@@ -109,41 +112,43 @@
         if not self.is_type_driver_enabled('vxlan'):
             msg = "Vxlan type driver must be enabled for this test."
             raise self.skipException(msg)
+        if not CONF.neutron_plugin_options.provider_vlans:
+            raise self.skipException("No provider VLAN networks available")
 
         trunk = self._create_trunk_with_network_and_parent(
-            subports=[], parent_network_type='vxlan')
+            parent_network_type='vxlan')
         subport_network = self.create_network()
-        parent_port = self.create_port(subport_network)
+        subport = self.create_port(subport_network)
         self.assertRaises(lib_exc.BadRequest, self.client.add_subports,
-                          trunk['trunk']['id'],
-                          [{'port_id': parent_port['id'],
+                          trunk['id'],
+                          [{'port_id': subport['id'],
                             'segmentation_type': 'inherit',
                             'segmentation_id': -1}])
 
     @decorators.attr(type='negative')
     @decorators.idempotent_id('40aed9be-e976-47d0-a555-bde2c7e74e57')
     def test_create_trunk_duplicate_subport_segmentation_ids(self):
-        trunk = self._create_trunk_with_network_and_parent([])
+        trunk = self._create_trunk_with_network_and_parent()
         subport_network1 = self.create_network()
         subport_network2 = self.create_network()
-        parent_port1 = self.create_port(subport_network1)
-        parent_port2 = self.create_port(subport_network2)
+        subport1 = self.create_port(subport_network1)
+        subport2 = self.create_port(subport_network2)
         self.assertRaises(lib_exc.BadRequest, self.client.create_trunk,
-                          trunk['trunk']['id'],
-                          [{'port_id': parent_port1['id'],
+                          trunk['id'],
+                          [{'port_id': subport1['id'],
                             'segmentation_id': 2,
                             'segmentation_type': 'vlan'},
-                           {'port_id': parent_port2['id'],
+                           {'port_id': subport2['id'],
                             'segmentation_id': 2,
                             'segmentation_type': 'vlan'}])
 
     @decorators.attr(type='negative')
     @decorators.idempotent_id('6f132ccc-1380-42d8-9c44-50411612bd01')
-    def test_add_subport_port_id_uses_trunk_port_id(self):
-        trunk = self._create_trunk_with_network_and_parent(None)
+    def test_add_subport_port_id_uses_parent_port_id(self):
+        trunk = self._create_trunk_with_network_and_parent()
         self.assertRaises(lib_exc.Conflict, self.client.add_subports,
-                          trunk['trunk']['id'],
-                          [{'port_id': trunk['trunk']['port_id'],
+                          trunk['id'],
+                          [{'port_id': trunk['port_id'],
                             'segmentation_type': 'vlan',
                             'segmentation_id': 2}])
 
@@ -151,67 +156,54 @@
     @decorators.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)
+            admin_state_up=False)
+        self.assertRaises(lib_exc.Conflict, self.client.add_subports,
+                          trunk['id'], [{'port_id': trunk['port_id'],
+                                         'segmentation_type': 'vlan',
+                                         'segmentation_id': 2}])
 
     @decorators.attr(type='negative')
     @decorators.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)
+            admin_state_up=False)
+        self.assertRaises(lib_exc.Conflict, self.client.remove_subports,
+                          trunk['id'], [{'port_id': trunk['port_id'],
+                                         'segmentation_type': 'vlan',
+                                         'segmentation_id': 2}])
 
     @decorators.attr(type='negative')
     @decorators.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)
+            admin_state_up=False)
+        self.assertRaises(lib_exc.Conflict, self.client.delete_trunk,
+                          trunk['id'])
 
     @decorators.attr(type='negative')
     @decorators.idempotent_id('00cb40bb-1593-44c8-808c-72b47e64252f')
     def test_add_subport_duplicate_segmentation_details(self):
-        trunk = self._create_trunk_with_network_and_parent(None)
+        trunk = self._create_trunk_with_network_and_parent()
         network = self.create_network()
-        parent_port1 = self.create_port(network)
-        parent_port2 = self.create_port(network)
-        self.client.add_subports(trunk['trunk']['id'],
-                                 [{'port_id': parent_port1['id'],
+        subport1 = self.create_port(network)
+        subport2 = self.create_port(network)
+        self.client.add_subports(trunk['id'],
+                                 [{'port_id': subport1['id'],
                                    'segmentation_type': 'vlan',
                                    'segmentation_id': 2}])
         self.assertRaises(lib_exc.Conflict, self.client.add_subports,
-                          trunk['trunk']['id'],
-                          [{'port_id': parent_port2['id'],
-                            'segmentation_type': 'vlan',
-                            'segmentation_id': 2}])
+                          trunk['id'], [{'port_id': subport2['id'],
+                                         'segmentation_type': 'vlan',
+                                         'segmentation_id': 2}])
 
     @decorators.attr(type='negative')
     @decorators.idempotent_id('4eac8c25-83ee-4051-9620-34774f565730')
     def test_add_subport_passing_dict(self):
-        trunk = self._create_trunk_with_network_and_parent(None)
+        trunk = self._create_trunk_with_network_and_parent()
         self.assertRaises(lib_exc.BadRequest, self.client.add_subports,
-                          trunk['trunk']['id'],
-                          {'port_id': trunk['trunk']['port_id'],
-                           'segmentation_type': 'vlan',
-                           'segmentation_id': 2})
+                          trunk['id'], {'port_id': trunk['port_id'],
+                                        'segmentation_type': 'vlan',
+                                        'segmentation_id': 2})
 
     @decorators.attr(type='negative')
     @decorators.idempotent_id('17ca7dd7-96a8-445a-941e-53c0c86c2fe2')
@@ -223,7 +215,7 @@
                         'segmentation_id': 2}
         trunk = self._create_trunk_with_network_and_parent([subport_data])
         self.assertRaises(lib_exc.BadRequest, self.client.remove_subports,
-                          trunk['trunk']['id'], subport_data)
+                          trunk['id'], subport_data)
 
     @decorators.attr(type='negative')
     @decorators.idempotent_id('aaca7dd7-96b8-445a-931e-63f0d86d2fe2')
@@ -233,16 +225,16 @@
         subport_data = {'port_id': parent_port['id'],
                         'segmentation_type': 'vlan',
                         'segmentation_id': 2}
-        trunk = self._create_trunk_with_network_and_parent([])
+        trunk = self._create_trunk_with_network_and_parent()
         self.assertRaises(lib_exc.NotFound, self.client.remove_subports,
-                          trunk['trunk']['id'], [subport_data])
+                          trunk['id'], [subport_data])
 
     @decorators.attr(type='negative')
     @decorators.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)
+        trunk = self._create_trunk_with_network_and_parent()
         self.assertRaises(lib_exc.Conflict, self.client.delete_port,
-                          trunk['trunk']['port_id'])
+                          trunk['port_id'])
 
     @decorators.attr(type='negative')
     @decorators.idempotent_id('343a03d0-4f7c-11e6-97fa-40a8f063c891')
diff --git a/neutron_tempest_plugin/scenario/test_trunk.py b/neutron_tempest_plugin/scenario/test_trunk.py
index 2ff7e5d..9a92b38 100644
--- a/neutron_tempest_plugin/scenario/test_trunk.py
+++ b/neutron_tempest_plugin/scenario/test_trunk.py
@@ -29,13 +29,11 @@
 CONF = config.CONF
 
 CONFIGURE_VLAN_INTERFACE_COMMANDS = (
-    'IFACE=$(PATH=$PATH:/usr/sbin ip l | grep "^[0-9]*: e" |'
-    'cut -d \: -f 2) && '
-    'sudo su -c '
-    '"ip l a link $IFACE name $IFACE.%(tag)d type vlan id %(tag)d &&'
-    'ip l s up dev $IFACE.%(tag)d && '
-    '{ ps -ef | grep -q "dhclient .*$IFACE.%(tag)d" || '
-    'dhclient $IFACE.%(tag)d"; }')
+    'IFACE=$(PATH=$PATH:/usr/sbin ip l | grep "^[0-9]*: e"|cut -d \: -f 2) &&'
+    'sudo ip l a link $IFACE name $IFACE.%(tag)d type vlan id %(tag)d &&'
+    'sudo ip l s up dev $IFACE.%(tag)d && '
+    'ps -ef | grep -q "[d]hclient .*$IFACE.%(tag)d" || '
+    'sudo dhclient $IFACE.%(tag)d;')
 
 
 class TrunkTest(base.BaseTempestTestCase):
@@ -61,9 +59,8 @@
     def _create_server_with_trunk_port(self):
         port = self.create_port(self.network, security_groups=[
             self.secgroup['security_group']['id']])
-        trunk = self.client.create_trunk(port['id'], subports=[])['trunk']
+        trunk = self.create_trunk(port)
         server, fip = self._create_server_with_fip(port['id'])
-        self.addCleanup(self._detach_and_delete_trunk, server, trunk)
         return {'port': port, 'trunk': trunk, 'fip': fip,
                 'server': server}
 
@@ -80,18 +77,6 @@
                 **server_kwargs)['server'],
             fip)
 
-    def _detach_and_delete_trunk(self, server, trunk):
-        # we have to detach the interface from the server before
-        # the trunk can be deleted.
-        self.os_primary.compute.InterfacesClient().delete_interface(
-            server['id'], trunk['port_id'])
-
-        def is_port_detached():
-            p = self.client.show_port(trunk['port_id'])['port']
-            return p['device_id'] == ''
-        utils.wait_until_true(is_port_detached)
-        self.client.delete_trunk(trunk['id'])
-
     def _is_port_down(self, port_id):
         p = self.client.show_port(port_id)['port']
         return p['status'] == 'DOWN'
@@ -115,11 +100,9 @@
             'port_id': port_for_subport['id'],
             'segmentation_type': 'vlan',
             'segmentation_id': vlan_tag}
-        trunk = self.client.create_trunk(
-            parent_port['id'], subports=[subport])['trunk']
+        self.create_trunk(parent_port, [subport])
 
         server, fip = self._create_server_with_fip(parent_port['id'])
-        self.addCleanup(self._detach_and_delete_trunk, server, trunk)
 
         server_ssh_client = ssh.Client(
             fip['floating_ip_address'],
@@ -141,7 +124,6 @@
                                 CONF.validation.image_ssh_user,
                                 self.keypair['private_key'])
 
-    @utils.unstable_test("bug 1766701")
     @decorators.idempotent_id('bb13fe28-f152-4000-8131-37890a40c79e')
     def test_trunk_subport_lifecycle(self):
         """Test trunk creation and subport transition to ACTIVE status.
@@ -222,7 +204,6 @@
                                 CONF.validation.image_ssh_user,
                                 self.keypair['private_key'])
 
-    @utils.unstable_test('bug 1766701')
     @testtools.skipUnless(
           CONF.neutron_plugin_options.image_is_advanced,
           "Advanced image is required to run this test.")
diff --git a/neutron_tempest_plugin/services/network/json/network_client.py b/neutron_tempest_plugin/services/network/json/network_client.py
index b316ce4..a28d668 100644
--- a/neutron_tempest_plugin/services/network/json/network_client.py
+++ b/neutron_tempest_plugin/services/network/json/network_client.py
@@ -461,6 +461,12 @@
         body = jsonutils.loads(body)
         return service_client.ResponseBody(resp, body)
 
+    def delete_agent(self, agent_id):
+        uri = '%s/agents/%s' % (self.uri_prefix, agent_id)
+        resp, body = self.delete(uri)
+        self.expected_success(204, resp.status)
+        return service_client.ResponseBody(resp, body)
+
     def list_routers_on_l3_agent(self, agent_id):
         uri = '%s/agents/%s/l3-routers' % (self.uri_prefix, agent_id)
         resp, body = self.get(uri)
diff --git a/releasenotes/notes/agents-client-delete-method-de1a7fb3f845999c.yaml b/releasenotes/notes/agents-client-delete-method-de1a7fb3f845999c.yaml
new file mode 100644
index 0000000..01c94f4
--- /dev/null
+++ b/releasenotes/notes/agents-client-delete-method-de1a7fb3f845999c.yaml
@@ -0,0 +1,7 @@
+---
+features:
+  - |
+    Added a new method ``delete_agent`` to the AgentsClient class that
+    implements agent deletion according to the neutron API.
+    https://developer.openstack.org/api-ref/network/v2/index.html#delete-agent
+
diff --git a/releasenotes/source/README.rst b/releasenotes/source/README.rst
new file mode 100644
index 0000000..a6677ca
--- /dev/null
+++ b/releasenotes/source/README.rst
@@ -0,0 +1,34 @@
+==========================================
+Neutron Tempest Plugin Release Notes Howto
+==========================================
+
+Release notes are a new feature for documenting new features in
+OpenStack projects. Background on the process, tooling, and
+methodology is documented in a `mailing list post by Doug Hellmann <http://lists.openstack.org/pipermail/openstack-dev/2015-November/078301.html>`_.
+
+Writing release notes
+---------------------
+
+For information on how to create release notes, please consult the
+`reno documentation <https://docs.openstack.org/reno/latest/user/usage.html>`__.
+
+Please keep the following in your mind when you write release notes.
+
+* **Avoid using "prelude" section** for individual release notes.
+  "prelude" section is for general comments about the release.
+* **Use one entry per section** (like "feature" or "upgrade").
+  All entries which belong to a same release will be merged and rendered,
+  so there is less meaning to use multiple entries by a single topic.
+
+Maintaining release notes
+-------------------------
+
+.. warning::
+
+   Avoid modifying an existing release note file even though it is related
+   to your change. If you modify a release note file of a past release,
+   the whole content will be shown in a latest release. The only allowed
+   case is to update a release note in a same release.
+
+   If you need to update a release note of a past release,
+   edit a corresponding release note file in a stable branch directly.
diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py
index d95fd58..66d6a9e 100644
--- a/releasenotes/source/conf.py
+++ b/releasenotes/source/conf.py
@@ -52,12 +52,12 @@
 master_doc = 'index'
 
 # General information about the project.
-project = u'neutron_tempest_plugin Release Notes'
-copyright = u'2017, OpenStack Developers'
+project = u'Neutron Tempest Plugin Release Notes'
+copyright = u'2017, Neutron Tempest Plugin Developers'
 
 # openstackdocstheme options
-repository_name = 'openstack/openstack'
-bug_project = 'neutron_tempest_plugin'
+repository_name = 'openstack/neutron-tempest-plugin'
+bug_project = 'neutron'
 bug_tag = ''
 
 # The version info for the project you're documenting, acts as replacement for
@@ -191,7 +191,7 @@
 # html_file_suffix = None
 
 # Output file base name for HTML help builder.
-htmlhelp_basename = 'neutron_tempest_pluginReleaseNotesdoc'
+htmlhelp_basename = 'NeutronTempestPluginReleaseNotesdoc'
 
 
 # -- Options for LaTeX output ---------------------------------------------
@@ -211,9 +211,9 @@
 # (source start file, target name, title,
 #  author, documentclass [howto, manual, or own class]).
 latex_documents = [
-    ('index', 'neutron_tempest_pluginReleaseNotes.tex',
-     u'neutron_tempest_plugin  Release Notes Documentation',
-     u'OpenStack Foundation', 'manual'),
+    ('index', 'NeutronTempestPluginReleaseNotes.tex',
+     u'Neutron Tempest Plugin Release Notes Documentation',
+     u'Neutron Tempest Plugin Developers', 'manual'),
 ]
 
 # The name of an image file (relative to this directory) to place at the top of
@@ -242,9 +242,9 @@
 # One entry per manual page. List of tuples
 # (source start file, name, description, authors, manual section).
 man_pages = [
-    ('index', 'neutron_tempest_pluginrereleasenotes',
-     u'neutron_tempest_plugin  Release Notes Documentation',
-     [u'OpenStack Foundation'], 1)
+    ('index', 'NeutronTempestPluginrereleasenotes',
+     u'Neutron Tempest Plugin Release Notes Documentation',
+     [u'Neutron Tempest Plugin Developers'], 1)
 ]
 
 # If true, show URL addresses after external links.
@@ -257,9 +257,10 @@
 # (source start file, target name, title, author,
 #  dir menu entry, description, category)
 texinfo_documents = [
-    ('index', 'neutron_tempest_plugin ReleaseNotes',
-     u'neutron_tempest_plugin Release Notes Documentation',
-     u'OpenStack Foundation', 'neutron_tempest_pluginReleaseNotes',
+    ('index', 'Neutron Tempest Plugin ReleaseNotes',
+     u'Neutron Tempest Plugin Release Notes Documentation',
+     u'Neutron Tempest Plugin Developers',
+     'NeutronTempestPluginReleaseNotes',
      'One line description of project.',
      'Miscellaneous'),
 ]
diff --git a/releasenotes/source/index.rst b/releasenotes/source/index.rst
index 2aa8030..5648f19 100644
--- a/releasenotes/source/index.rst
+++ b/releasenotes/source/index.rst
@@ -1,8 +1,13 @@
-============================================
- neutron_tempest_plugin Release Notes
-============================================
+======================================
+ Neutron Tempest Plugin Release Notes
+======================================
 
 .. toctree::
    :maxdepth: 1
 
    unreleased
+
+.. toctree::
+   :maxdepth: 1
+
+   README.rst
diff --git a/setup.cfg b/setup.cfg
index a54cc6c..c6a1fad 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
 [metadata]
-name = neutron_tempest_plugin
+name = neutron-tempest-plugin
 summary = Tempest plugin for Neutron Project
 description-file =
     README.rst
@@ -16,8 +16,7 @@
     Programming Language :: Python :: 2
     Programming Language :: Python :: 2.7
     Programming Language :: Python :: 3
-    Programming Language :: Python :: 3.3
-    Programming Language :: Python :: 3.4
+    Programming Language :: Python :: 3.5
 
 [files]
 packages =
@@ -33,11 +32,11 @@
 upload-dir = doc/build/html
 
 [compile_catalog]
-directory = neutron/locale
-domain = neutron
+directory = neutron_tempest_plugin/locale
+domain = neutron-tempest-plugin
 
 [update_catalog]
-domain = neutron_tempest_plugin
+domain = neutron-tempest-plugin
 output_dir = neutron_tempest_plugin/locale
 input_file = neutron_tempest_plugin/locale/neutron_tempest_plugin.pot