Add zones_import_client's methods and tests to Designate tempest plugin

Partially-Implements: blueprint designate-tempest-plugin

Change-Id: If01461617020f39b4da554b127e7b5e5fd704645
diff --git a/designate_tempest_plugin/common/waiters.py b/designate_tempest_plugin/common/waiters.py
index a75870b..9563656 100644
--- a/designate_tempest_plugin/common/waiters.py
+++ b/designate_tempest_plugin/common/waiters.py
@@ -81,3 +81,36 @@
                 message = '(%s) %s' % (caller, message)
 
             raise lib_exc.TimeoutException(message)
+
+
+def wait_for_zone_import_status(client, zone_import_id, status):
+    """Waits for an imported zone to reach the given status."""
+    LOG.info('Waiting for zone import %s to reach %s', zone_import_id, status)
+
+    _, zone_import = client.show_zone_import(zone_import_id)
+    start = int(time.time())
+
+    while zone_import['status'] != status:
+        time.sleep(client.build_interval)
+        _, zone_import = client.show_zone_import(zone_import_id)
+        status_curr = zone_import['status']
+        if status_curr == status:
+            LOG.info('Zone import %s reached %s', zone_import_id, status)
+            return
+
+        if int(time.time()) - start >= client.build_timeout:
+            message = ('Zone import %(zone_import_id)s failed to reach '
+                       'status=%(status)s within the required time '
+                       '(%(timeout)s s). Current '
+                       'status: %(status_curr)s' %
+                       {'zone_import_id': zone_import_id,
+                        'status': status,
+                        'status_curr': status_curr,
+                        'timeout': client.build_timeout})
+
+            caller = misc_utils.find_test_caller()
+
+            if caller:
+                message = '(%s) %s' % (caller, message)
+
+            raise lib_exc.TimeoutException(message)