Merge "Add start of the EC2/S3 API testing to tempest"
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 5f37f59..94fe637 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -404,3 +404,95 @@
         resp, body = self.post("servers/%s/action" % str(server_id),
                                req_body, self.headers)
         return resp, body
+
+    def list_servers_for_all_tenants(self):
+
+        url = self.base_url + '/servers?all_tenants=1'
+        resp = self.requests.get(url)
+        resp, body = self.post('servers', post_body, self.headers)
+
+        body = json.loads(body)
+        return resp, body['servers']
+
+    def migrate_server(self, server_id):
+        """Migrates a server to a new host"""
+        post_body = {'migrate': 'null'}
+        post_body = json.dumps(post_body)
+        resp, body = self.post('servers/%s/action' % server_id,
+                               post_body, self.headers)
+        return resp, body
+
+    def confirm_migration(self, server_id):
+        """Confirms the migration of a server"""
+        post_body = {'confirmResize': 'null'}
+        post_body = json.dumps(post_body)
+        resp, body = self.post('servers/%s/action' % server_id,
+                               post_body, self.headers)
+        return resp, body
+
+    def lock_server(self, server_id):
+        """Locks the given server"""
+        post_body = {'lock': 'null'}
+        post_body = json.dumps(post_body)
+        resp, body = self.post('servers/%s/action' % server_id,
+                               post_body, self.headers)
+
+    def unlock_server(self, server_id):
+        """UNlocks the given server"""
+        post_body = {'unlock': 'null'}
+        post_body = json.dumps(post_body)
+        resp, body = self.post('servers/%s/action' % server_id,
+                               post_body, self.headers)
+
+    def start_server(self, server_id):
+        """Starts the given server"""
+        post_body = {'os-start': 'null'}
+        post_body = json.dumps(post_body)
+        resp, body = self.post('servers/%s/action' % server_id,
+                               post_body, self.headers)
+
+    def stop_server(self, server_id):
+        """Stops the given server"""
+        post_body = {'os-stop': 'null'}
+        post_body = json.dumps(post_body)
+        resp, body = self.post('servers/%s/action' % server_id,
+                               post_body, self.headers)
+
+    def suspend_server(self, server_id):
+        """Suspends the provded server"""
+        post_body = {'suspend': 'null'}
+        post_body = json.dumps(post_body)
+        resp, body = self.post('servers/%s/action' % server_id,
+                               post_body, self.headers)
+
+    def resume_server(self, server_id):
+        """Un-suspends the provded server"""
+        post_body = {'resume': 'null'}
+        post_body = json.dumps(post_body)
+        resp, body = self.post('servers/%s/action' % server_id,
+                               post_body, self.headers)
+
+    def pause_server(self, server_id):
+        """Pauses the provded server"""
+        post_body = {'pause': 'null'}
+        post_body = json.dumps(post_body)
+        resp, body = self.post('servers/%s/action' % server_id,
+                               post_body, self.headers)
+
+    def unpause_server(self, server_id):
+        """Un-pauses the provded server"""
+        post_body = {'unpause': 'null'}
+        post_body = json.dumps(post_body)
+        resp, body = self.post('servers/%s/action' % server_id,
+                               post_body, self.headers)
+
+    def reset_state(self, server_id, new_state='error'):
+        """Resets the state of a server to active/error"""
+        post_body = {
+            'os-resetState': {
+                'state': new_state
+            }
+        }
+        resp, body = self.post('servers/%s/action' % server_id,
+                               post_body, self.headers)
+        return resp, body