Merge "Have RouterRoute object increment Router revision"
diff --git a/neutron/tests/tempest/api/base.py b/neutron/tests/tempest/api/base.py
index 39c714c..b308a31 100644
--- a/neutron/tests/tempest/api/base.py
+++ b/neutron/tests/tempest/api/base.py
@@ -594,7 +594,7 @@
         }
         body = self.list_method(**pagination_args)
         resources = self._extract_resources(body)
-        self.assertTrue(len(resources) >= len(self.resource_names))
+        self.assertGreaterEqual(len(resources), len(self.resource_names))
 
     def _test_list_pagination_iteratively(self, lister):
         # first, collect all resources for later comparison
@@ -709,7 +709,7 @@
                 self.plural_name, uri
             )
             resources_ = self._extract_resources(body)
-            self.assertTrue(page_size >= len(resources_))
+            self.assertGreaterEqual(page_size, len(resources_))
             resources.extend(reversed(resources_))
 
         self.assertSameOrder(expected_resources, reversed(resources))
diff --git a/neutron/tests/tempest/api/test_address_scopes.py b/neutron/tests/tempest/api/test_address_scopes.py
index 8290784..5cecb77 100644
--- a/neutron/tests/tempest/api/test_address_scopes.py
+++ b/neutron/tests/tempest/api/test_address_scopes.py
@@ -79,6 +79,17 @@
                          returned_address_scope['name'])
         self.assertFalse(returned_address_scope['shared'])
 
+    @test.idempotent_id('bbd57364-6d57-48e4-b0f1-8b9a998f5e06')
+    @test.requires_ext(extension="project-id", service="network")
+    def test_show_address_scope_project_id(self):
+        address_scope = self._create_address_scope(ip_version=4)
+        body = self.client.show_address_scope(address_scope['id'])
+        show_addr_scope = body['address_scope']
+        self.assertIn('project_id', show_addr_scope)
+        self.assertIn('tenant_id', show_addr_scope)
+        self.assertEqual(self.client.tenant_id, show_addr_scope['project_id'])
+        self.assertEqual(self.client.tenant_id, show_addr_scope['tenant_id'])
+
     @test.idempotent_id('85a259b2-ace6-4e32-9657-a9a392b452aa')
     def test_tenant_update_address_scope(self):
         self._test_update_address_scope_helper()
diff --git a/neutron/tests/tempest/api/test_networks.py b/neutron/tests/tempest/api/test_networks.py
index 279964a..8c00c86 100644
--- a/neutron/tests/tempest/api/test_networks.py
+++ b/neutron/tests/tempest/api/test_networks.py
@@ -121,6 +121,22 @@
         self.assertEqual(project_id, new_net['project_id'])
         self.assertEqual(project_id, new_net['tenant_id'])
 
+    @test.idempotent_id('94e2a44c-3367-4253-8c2a-22deaf59e96c')
+    @test.requires_ext(extension="dns-integration",
+                       service="network")
+    def test_create_update_network_dns_domain(self):
+        domain1 = 'test.org.'
+        body = self.create_network(dns_domain=domain1)
+        self.assertEqual(domain1, body['dns_domain'])
+        net_id = body['id']
+        body = self.client.list_networks(id=net_id)['networks'][0]
+        self.assertEqual(domain1, body['dns_domain'])
+        domain2 = 'd.org.'
+        body = self.client.update_network(net_id, dns_domain=domain2)
+        self.assertEqual(domain2, body['network']['dns_domain'])
+        body = self.client.show_network(net_id)['network']
+        self.assertEqual(domain2, body['dns_domain'])
+
     @test.idempotent_id('6ae6d24f-9194-4869-9c85-c313cb20e080')
     def test_list_networks_fields(self):
         # Verify specific fields of the networks
diff --git a/neutron/tests/tempest/api/test_ports.py b/neutron/tests/tempest/api/test_ports.py
index 093de07..034f07e 100644
--- a/neutron/tests/tempest/api/test_ports.py
+++ b/neutron/tests/tempest/api/test_ports.py
@@ -25,6 +25,23 @@
         super(PortsTestJSON, cls).resource_setup()
         cls.network = cls.create_network()
 
+    def _confirm_dns_assignment(self, port):
+        # NOTE(manjeets) port created with single subnet
+        # would have only one dns_assignment
+        dns_assignment = port['dns_assignment'][0]
+        ip = port['fixed_ips'][0]['ip_address']
+        if port['dns_name']:
+            hostname = port['dns_name']
+        else:
+            hostname = 'host-%s' % ip.replace('.', '-')
+        self.assertEqual(hostname, dns_assignment['hostname'])
+
+        # To avoid hard coding the expected dns_domain value
+        # in neutron.conf we just check that the fqdn starts
+        # with correct hostname
+        self.assertTrue(dns_assignment['fqdn'].startswith(hostname))
+        self.assertEqual(ip, dns_assignment['ip_address'])
+
     @test.idempotent_id('c72c1c0c-2193-4aca-bbb4-b1442640bbbb')
     @test.requires_ext(extension="standard-attr-description",
                        service="network")
@@ -40,6 +57,39 @@
         body = self.client.list_ports(id=body['port']['id'])['ports'][0]
         self.assertEqual('d2', body['description'])
 
+    @test.idempotent_id('539fbefe-fb36-48aa-9a53-8c5fbd44e492')
+    @test.requires_ext(extension="dns-integration",
+                       service="network")
+    def test_create_update_port_with_dns_name(self):
+        # NOTE(manjeets) dns_domain is set to openstackgate.local
+        # so dns_name for port can be set
+        self.create_subnet(self.network)
+        body = self.create_port(self.network, dns_name='d1')
+        self.assertEqual('d1', body['dns_name'])
+        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'])
+        body = self.client.update_port(body['id'],
+                                       dns_name='d2')
+        self.assertEqual('d2', body['port']['dns_name'])
+        self._confirm_dns_assignment(body['port'])
+        body = self.client.show_port(body['port']['id'])['port']
+        self.assertEqual('d2', body['dns_name'])
+        self._confirm_dns_assignment(body)
+
+    @test.idempotent_id('435e89df-a8bb-4b41-801a-9f20d362d777')
+    @test.requires_ext(extension="dns-integration",
+                       service="network")
+    def test_create_update_port_with_no_dns_name(self):
+        self.create_subnet(self.network)
+        body = self.create_port(self.network)
+        self.assertFalse(body['dns_name'])
+        self._confirm_dns_assignment(body)
+        port_body = self.client.show_port(body['id'])
+        self.assertFalse(port_body['port']['dns_name'])
+        self._confirm_dns_assignment(port_body['port'])
+
     @test.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)
diff --git a/neutron/tests/tempest/api/test_qos.py b/neutron/tests/tempest/api/test_qos.py
index b9572ca..2f1c75a 100644
--- a/neutron/tests/tempest/api/test_qos.py
+++ b/neutron/tests/tempest/api/test_qos.py
@@ -46,6 +46,19 @@
         policies_ids = [p['id'] for p in policies]
         self.assertIn(policy['id'], policies_ids)
 
+    @test.idempotent_id('606a48e2-5403-4052-b40f-4d54b855af76')
+    @test.requires_ext(extension="project-id", service="network")
+    def test_show_policy_has_project_id(self):
+        policy = self.create_qos_policy(name='test-policy', shared=False)
+        body = self.admin_client.show_qos_policy(policy['id'])
+        show_policy = body['policy']
+        self.assertIn('project_id', show_policy)
+        self.assertIn('tenant_id', show_policy)
+        self.assertEqual(self.admin_client.tenant_id,
+                         show_policy['project_id'])
+        self.assertEqual(self.admin_client.tenant_id,
+                         show_policy['tenant_id'])
+
     @test.idempotent_id('f8d20e92-f06d-4805-b54f-230f77715815')
     def test_list_policy_filter_by_name(self):
         self.create_qos_policy(name='test', description='test policy',
diff --git a/neutron/tests/tempest/api/test_subnetpools.py b/neutron/tests/tempest/api/test_subnetpools.py
index e8ec954..763d06c 100644
--- a/neutron/tests/tempest/api/test_subnetpools.py
+++ b/neutron/tests/tempest/api/test_subnetpools.py
@@ -133,6 +133,17 @@
         self.assertEqual(prefixlen, subnetpool['default_prefixlen'])
         self.assertFalse(subnetpool['shared'])
 
+    @test.idempotent_id('5bf9f1e2-efc8-4195-acf3-d12b2bd68dd3')
+    @test.requires_ext(extension="project-id", service="network")
+    def test_show_subnetpool_has_project_id(self):
+        subnetpool = self._create_subnetpool()
+        body = self.client.show_subnetpool(subnetpool['id'])
+        show_subnetpool = body['subnetpool']
+        self.assertIn('project_id', show_subnetpool)
+        self.assertIn('tenant_id', show_subnetpool)
+        self.assertEqual(self.client.tenant_id, show_subnetpool['project_id'])
+        self.assertEqual(self.client.tenant_id, show_subnetpool['tenant_id'])
+
     @test.idempotent_id('764f1b93-1c4a-4513-9e7b-6c2fc5e9270c')
     def test_tenant_update_subnetpool(self):
         created_subnetpool = self._create_subnetpool()
diff --git a/neutron/tests/tempest/api/test_trunk.py b/neutron/tests/tempest/api/test_trunk.py
index 3dc8f0d..6763517 100644
--- a/neutron/tests/tempest/api/test_trunk.py
+++ b/neutron/tests/tempest/api/test_trunk.py
@@ -100,6 +100,17 @@
         self.client.delete_trunk(trunk_id)
         self.assertRaises(lib_exc.NotFound, self._show_trunk, trunk_id)
 
+    @test.idempotent_id('8d83a6ca-662d-45b8-8062-d513077296aa')
+    @test.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'])
+
     @test.idempotent_id('4ce46c22-a2b6-4659-bc5a-0ef2463cab32')
     def test_create_update_trunk(self):
         trunk = self._create_trunk_with_network_and_parent(None)