Merge "Fix DefaultSubnetPool API test"
diff --git a/neutron/tests/tempest/api/admin/test_floating_ips_admin_actions.py b/neutron/tests/tempest/api/admin/test_floating_ips_admin_actions.py
index e6184b3..8fb8f66 100644
--- a/neutron/tests/tempest/api/admin/test_floating_ips_admin_actions.py
+++ b/neutron/tests/tempest/api/admin/test_floating_ips_admin_actions.py
@@ -43,25 +43,22 @@
 
     @decorators.attr(type='negative')
     @decorators.idempotent_id('11116ee9-4e99-5b15-b8e1-aa7df92ca589')
-    def test_associate_floating_ip_with_port_from_another_tenant(self):
-        if not CONF.identity_feature_enabled.api_v2_admin:
-            # TODO(ihrachys) adopt to v3
-            raise self.skipException('Identity v2 admin not available')
-        body = self.admin_client.create_floatingip(
+    def test_associate_floating_ip_with_port_from_another_project(self):
+        body = self.client.create_floatingip(
             floating_network_id=self.ext_net_id)
         floating_ip = body['floatingip']
-        test_tenant = data_utils.rand_name('test_tenant_')
+        test_project = data_utils.rand_name('test_project_')
         test_description = data_utils.rand_name('desc_')
-        tenant = self.identity_admin_client.create_tenant(
-            name=test_tenant, description=test_description)['tenant']
-        tenant_id = tenant['id']
-        self.addCleanup(self.identity_admin_client.delete_tenant, tenant_id)
+        project = self.identity_admin_client.create_project(
+            name=test_project, description=test_description)['project']
+        project_id = project['id']
+        self.addCleanup(self.identity_admin_client.delete_project, project_id)
 
         port = self.admin_client.create_port(network_id=self.network['id'],
-                                             tenant_id=tenant_id)
+                                             project_id=project_id)
         self.addCleanup(self.admin_client.delete_port, port['port']['id'])
         self.assertRaises(lib_exc.BadRequest,
-                          self.admin_client.update_floatingip,
+                          self.client.update_floatingip,
                           floating_ip['id'], port_id=port['port']['id'])
 
     @testtools.skipUnless(
diff --git a/neutron/tests/tempest/api/admin/test_quotas.py b/neutron/tests/tempest/api/admin/test_quotas.py
index fe8f511..04ea492 100644
--- a/neutron/tests/tempest/api/admin/test_quotas.py
+++ b/neutron/tests/tempest/api/admin/test_quotas.py
@@ -37,11 +37,11 @@
         # Add a tenant to conduct the test
         test_tenant = data_utils.rand_name('test_tenant_')
         test_description = data_utils.rand_name('desc_')
-        project = self.identity_admin_clientv3.create_project(
+        project = self.identity_admin_client.create_project(
             name=test_tenant,
             description=test_description)['project']
         self.addCleanup(
-            self.identity_admin_clientv3.delete_project, project['id'])
+            self.identity_admin_client.delete_project, project['id'])
         return project
 
     def _setup_quotas(self, project_id, **new_quotas):
diff --git a/neutron/tests/tempest/api/base.py b/neutron/tests/tempest/api/base.py
index e735502..31285ac 100644
--- a/neutron/tests/tempest/api/base.py
+++ b/neutron/tests/tempest/api/base.py
@@ -430,8 +430,7 @@
     def setup_clients(cls):
         super(BaseAdminNetworkTest, cls).setup_clients()
         cls.admin_client = cls.os_admin.network_client
-        cls.identity_admin_client = cls.os_admin.tenants_client
-        cls.identity_admin_clientv3 = cls.os_admin.projects_client
+        cls.identity_admin_client = cls.os_admin.projects_client
 
     @classmethod
     def create_metering_label(cls, name, description):
diff --git a/neutron/tests/tempest/api/test_floating_ips.py b/neutron/tests/tempest/api/test_floating_ips.py
index b1511af..3e21356 100644
--- a/neutron/tests/tempest/api/test_floating_ips.py
+++ b/neutron/tests/tempest/api/test_floating_ips.py
@@ -51,7 +51,6 @@
         body = self.client.create_floatingip(
             floating_network_id=self.ext_net_id,
             port_id=self.ports[0]['id'],
-            description='d1'
         )['floatingip']
         self.floating_ips.append(body)
         self.assertEqual(self.ports[0]['id'], body['port_id'])
diff --git a/neutron/tests/tempest/api/test_networks.py b/neutron/tests/tempest/api/test_networks.py
index 0b39569..b350068 100644
--- a/neutron/tests/tempest/api/test_networks.py
+++ b/neutron/tests/tempest/api/test_networks.py
@@ -15,8 +15,10 @@
 
 from tempest.lib import decorators
 from tempest import test
+import testtools
 
 from neutron.tests.tempest.api import base
+from neutron.tests.tempest import config
 
 
 class NetworksTestJSON(base.BaseNetworkTest):
@@ -129,6 +131,35 @@
         _check_list_networks_fields(['project_id', 'tenant_id'], True, True)
 
 
+# TODO(ihrachys): check that bad mtu is not allowed; current API extension
+# definition doesn't enforce values
+# TODO(ihrachys): check that new segment reservation updates mtu, once
+# https://review.openstack.org/#/c/353115/ is merged
+class NetworksMtuTestJSON(base.BaseNetworkTest):
+    required_extensions = ['net-mtu', 'net-mtu-writable']
+
+    @decorators.idempotent_id('c79dbf94-ee26-420f-a56f-382aaccb1a41')
+    def test_create_network_custom_mtu(self):
+        # 68 should be supported by all implementations, as per api-ref
+        network = self.create_network(mtu=68)
+        body = self.client.show_network(network['id'])['network']
+        self.assertEqual(68, body['mtu'])
+
+    @decorators.idempotent_id('2d35d49d-9d16-465c-92c7-4768eb717688')
+    @testtools.skipUnless(config.CONF.network_feature_enabled.ipv6,
+                          'IPv6 is not enabled')
+    def test_update_network_custom_mtu(self):
+        # 68 should be supported by all implementations, as per api-ref
+        network = self.create_network(mtu=68)
+        body = self.client.show_network(network['id'])['network']
+        self.assertEqual(68, body['mtu'])
+
+        # 1280 should be supported by all ipv6 compliant implementations
+        self.client.update_network(network['id'], mtu=1280)
+        body = self.client.show_network(network['id'])['network']
+        self.assertEqual(1280, body['mtu'])
+
+
 class NetworksSearchCriteriaTest(base.BaseSearchCriteriaTest):
 
     resource = 'network'
diff --git a/neutron/tests/tempest/api/test_ports.py b/neutron/tests/tempest/api/test_ports.py
index 8d8468c..acafa57 100644
--- a/neutron/tests/tempest/api/test_ports.py
+++ b/neutron/tests/tempest/api/test_ports.py
@@ -91,6 +91,30 @@
         self.assertFalse(port_body['port']['dns_name'])
         self._confirm_dns_assignment(port_body['port'])
 
+    @decorators.idempotent_id('dfe8cc79-18d9-4ae8-acef-3ec6bb719aa7')
+    @test.requires_ext(extension="dns-domain-ports",
+                       service="network")
+    def test_create_update_port_with_dns_domain(self):
+        self.create_subnet(self.network)
+        body = self.create_port(self.network, dns_name='d1',
+                                dns_domain='test.org.')
+        self.assertEqual('d1', body['dns_name'])
+        self.assertEqual('test.org.', body['dns_domain'])
+        self._confirm_dns_assignment(body)
+        body = self.client.list_ports(id=body['id'])['ports'][0]
+        self._confirm_dns_assignment(body)
+        self.assertEqual('d1', body['dns_name'])
+        self.assertEqual('test.org.', body['dns_domain'])
+        body = self.client.update_port(body['id'],
+                                       dns_name='d2', dns_domain='d.org.')
+        self.assertEqual('d2', body['port']['dns_name'])
+        self.assertEqual('d.org.', body['dns_domain'])
+        self._confirm_dns_assignment(body['port'])
+        body = self.client.show_port(body['port']['id'])['port']
+        self.assertEqual('d2', body['dns_name'])
+        self.assertEqual('d.org.', body['dns_domain'])
+        self._confirm_dns_assignment(body)
+
     @decorators.idempotent_id('c72c1c0c-2193-4aca-bbb4-b1442640c123')
     def test_change_dhcp_flag_then_create_port(self):
         s = self.create_subnet(self.network, enable_dhcp=False)