Merge "Add API tests for router and DHCP port status"
diff --git a/neutron/tests/tempest/api/admin/test_dhcp_agent_scheduler.py b/neutron/tests/tempest/api/admin/test_dhcp_agent_scheduler.py
index d058ffd..5576e0d 100644
--- a/neutron/tests/tempest/api/admin/test_dhcp_agent_scheduler.py
+++ b/neutron/tests/tempest/api/admin/test_dhcp_agent_scheduler.py
@@ -12,8 +12,10 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from neutron_lib import constants
 from tempest import test
 
+from neutron.common import utils
 from neutron.tests.tempest.api import base
 
 
@@ -30,6 +32,18 @@
         cls.cidr = cls.subnet['cidr']
         cls.port = cls.create_port(cls.network)
 
+    @test.idempotent_id('f164801e-1dd8-4b8b-b5d3-cc3ac77cfaa5')
+    def test_dhcp_port_status_active(self):
+
+        def dhcp_port_active():
+            for p in self.client.list_ports(
+                    network_id=self.network['id'])['ports']:
+                if (p['device_owner'] == constants.DEVICE_OWNER_DHCP and
+                        p['status'] == constants.PORT_STATUS_ACTIVE):
+                    return True
+            return False
+        utils.wait_until_true(dhcp_port_active)
+
     @test.idempotent_id('5032b1fe-eb42-4a64-8f3b-6e189d8b5c7d')
     def test_list_dhcp_agent_hosting_network(self):
         self.admin_client.list_dhcp_agent_hosting_network(
diff --git a/neutron/tests/tempest/api/test_routers.py b/neutron/tests/tempest/api/test_routers.py
index 90e13ed..20e54cf 100644
--- a/neutron/tests/tempest/api/test_routers.py
+++ b/neutron/tests/tempest/api/test_routers.py
@@ -18,6 +18,7 @@
 from tempest.lib.common.utils import data_utils
 from tempest import test
 
+from neutron.common import utils
 from neutron.tests.tempest.api import base
 from neutron.tests.tempest.api import base_routers
 from neutron.tests.tempest import config
@@ -153,6 +154,17 @@
              'enable_snat': False})
         self._verify_gateway_port(router['id'])
 
+    @test.idempotent_id('db3093b1-93b6-4893-be83-c4716c251b3e')
+    def test_router_interface_status(self):
+        network = self.create_network()
+        subnet = self.create_subnet(network)
+        # Add router interface with subnet id
+        router = self._create_router(data_utils.rand_name('router-'), True)
+        intf = self.create_router_interface(router['id'], subnet['id'])
+        status_active = lambda: self.client.show_port(
+            intf['port_id'])['port']['status'] == 'ACTIVE'
+        utils.wait_until_true(status_active)
+
     @test.idempotent_id('c86ac3a8-50bd-4b00-a6b8-62af84a0765c')
     @test.requires_ext(extension='extraroute', service='network')
     def test_update_extra_route(self):