Add check service status for Designate

In Designatev2 module we check service status by compare `updated_at`
field and current system date plus delta time, that we add for service
response.
We do it becauce designate 'v2/service_statuses'show the list of services
running, and when they last reported as running.
Upstream releasenotes link:
https://github.com/openstack/designate/blob
      /6a368fb5d3cc70d73820d8f613ceaad28e5f3f0c/releasenotes/notes
      /service-status-ab0e696c8f5fdef8.yaml

Change-Id: Ic888cf249b00cc6bc8af58219d206412c07b6512
Related-Prod: PROD-25159 (PROD:25159)
diff --git a/_modules/designatev2/services.py b/_modules/designatev2/services.py
new file mode 100644
index 0000000..d18b156
--- /dev/null
+++ b/_modules/designatev2/services.py
@@ -0,0 +1,44 @@
+from designatev2.lists import status_list
+from salt.exceptions import CommandExecutionError
+import datetime
+import time
+
+
+def wait_for_services(cloud_name, host, service=None, retries=18, timeout=10, time_delta=5):
+    """Ensure the service is up and running on specified host.
+    :example:              salt-call designatev2.wait_for_services admin_identity host=cfg01 service=mdns
+    :param host:           name of a host where service is running
+    :param service:        name of the service (by default designate)
+    :param timeout:        number of seconds to wait before retries
+    :param retries:        number of retries
+    :time_delta:           time interval that can be between the request and service response
+    """
+
+    for _i in range(retries):
+        time_actual = datetime.datetime.now()
+        services = status_list(cloud_name=cloud_name)['service_statuses']
+        service_list = []
+        service_active = []
+
+        for s in services:
+            if s['hostname'] == host:
+                service_list.append(s['service_name'])
+
+        for s in services:
+            updated_at = datetime.datetime.strptime(s['updated_at'], '%Y-%m-%dT%H:%M:%S.%f')
+            time_diff = abs((time_actual - updated_at).total_seconds()) <= time_delta
+            service_name = s['service_name']
+
+            if s['hostname'] == host and time_diff:
+                if service is None:
+                    service_active.append(s['service_name'])
+                else:
+                    if service_name == service:
+                        return 'Designate-%s service are UP' % (service)
+            elif service_name == service and not time_diff:
+                continue
+
+        if len(service_list) == len(service_active):
+            return 'All Designate services are UP'
+        time.sleep(timeout)
+    raise CommandExecutionError("Designate-{} services are still down".format(set(service_list) - set(service_active)))